summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2023-10-29 21:48:11 +0800
committerGitHub <noreply@github.com>2023-10-29 14:48:11 +0100
commite17237ce9dbf5410623e9d510217e7817bf4fd89 (patch)
treed521fd68ae6e7abff399c13b51a55352de379d28
parent0c26d19e228e831393cb5d2c1f43660362d349c9 (diff)
downloadNim-e17237ce9dbf5410623e9d510217e7817bf4fd89.tar.gz
prepare for the enforcement of `std` prefix (#22873)
follow up https://github.com/nim-lang/Nim/pull/22851
-rw-r--r--compiler/aliases.nim4
-rw-r--r--compiler/ast.nim6
-rw-r--r--compiler/astalgo.nim7
-rw-r--r--compiler/ccgtypes.nim2
-rw-r--r--compiler/ccgutils.nim4
-rw-r--r--compiler/cgen.nim12
-rw-r--r--compiler/cgendata.nim6
-rw-r--r--compiler/cgmeth.nim5
-rw-r--r--compiler/closureiters.nim4
-rw-r--r--compiler/cmdlinehelper.nim4
-rw-r--r--compiler/commands.nim4
-rw-r--r--compiler/concepts.nim4
-rw-r--r--compiler/condsyms.nim3
-rw-r--r--compiler/depends.nim2
-rw-r--r--compiler/dfa.nim3
-rw-r--r--compiler/docgen.nim11
-rw-r--r--compiler/errorhandling.nim3
-rw-r--r--compiler/evalffi.nim6
-rw-r--r--compiler/evaltempl.nim4
-rw-r--r--compiler/filter_tmpl.nim4
-rw-r--r--compiler/filters.nim4
-rw-r--r--compiler/gorgeimpl.nim5
-rw-r--r--compiler/guards.nim2
-rw-r--r--compiler/ic/bitabs.nim3
-rw-r--r--compiler/ic/cbackend.nim2
-rw-r--r--compiler/ic/ic.nim4
-rw-r--r--compiler/ic/integrity.nim2
-rw-r--r--compiler/ic/navigator.nim4
-rw-r--r--compiler/ic/packed_ast.nim2
-rw-r--r--compiler/ic/replayer.nim2
-rw-r--r--compiler/ic/rodfiles.nim2
-rw-r--r--compiler/idents.nim4
-rw-r--r--compiler/importer.nim15
-rw-r--r--compiler/injectdestructors.nim6
-rw-r--r--compiler/int128.nim4
-rw-r--r--compiler/isolation_check.nim4
-rw-r--r--compiler/jsgen.nim4
-rw-r--r--compiler/lambdalifting.nim6
-rw-r--r--compiler/lexer.nim6
-rw-r--r--compiler/liftdestructors.nim3
-rw-r--r--compiler/liftlocals.nim4
-rw-r--r--compiler/lineinfos.nim7
-rw-r--r--compiler/lookups.nim8
-rw-r--r--compiler/modulegraphs.nim2
-rw-r--r--compiler/modulepaths.nim4
-rw-r--r--compiler/nilcheck.nim4
-rw-r--r--compiler/nim.cfg5
-rw-r--r--compiler/nim.nim2
-rw-r--r--compiler/nimblecmd.nim5
-rw-r--r--compiler/nimconf.nim6
-rw-r--r--compiler/nimlexbase.nim5
-rw-r--r--compiler/nimpaths.nim2
-rw-r--r--compiler/nir/nir.nim2
-rw-r--r--compiler/nir/stringcases.nim2
-rw-r--r--compiler/nodejs.nim2
-rw-r--r--compiler/optimizer.nim4
-rw-r--r--compiler/options.nim11
-rw-r--r--compiler/parampatterns.nim4
-rw-r--r--compiler/parser.nim4
-rw-r--r--compiler/pathutils.nim2
-rw-r--r--compiler/platform.nim2
-rw-r--r--compiler/pragmas.nim6
-rw-r--r--compiler/prefixmatches.nim2
-rw-r--r--compiler/procfind.nim4
-rw-r--r--compiler/renderer.nim4
-rw-r--r--compiler/renderverbatim.nim2
-rw-r--r--compiler/reorder.nim4
-rw-r--r--compiler/rodutils.nim2
-rw-r--r--compiler/scriptconfig.nim6
-rw-r--r--compiler/sem.nim11
-rw-r--r--compiler/semdata.nim6
-rw-r--r--compiler/semfold.nim7
-rw-r--r--compiler/semobjconstr.nim2
-rw-r--r--compiler/semparallel.nim2
-rw-r--r--compiler/sempass2.nim8
-rw-r--r--compiler/sighashes.nim5
-rw-r--r--compiler/sigmatch.nim6
-rw-r--r--compiler/suggest.nim6
-rw-r--r--compiler/syntaxes.nim3
-rw-r--r--compiler/treetab.nim5
-rw-r--r--compiler/typeallowed.nim4
-rw-r--r--compiler/types.nim4
-rw-r--r--compiler/typesrenderer.nim3
-rw-r--r--compiler/vmdeps.nim4
-rw-r--r--compiler/vmgen.nim6
-rw-r--r--compiler/vmmarshal.nim4
-rw-r--r--compiler/vmprofiler.nim6
-rw-r--r--compiler/wordrecg.nim2
88 files changed, 244 insertions, 149 deletions
diff --git a/compiler/aliases.nim b/compiler/aliases.nim
index fa9824c41..40d6e272c 100644
--- a/compiler/aliases.nim
+++ b/compiler/aliases.nim
@@ -10,7 +10,9 @@
 ## Simple alias analysis for the HLO and the code generators.
 
 import
-  ast, astalgo, types, trees, intsets
+  ast, astalgo, types, trees
+
+import std/intsets
 
 when defined(nimPreviewSlimSystem):
   import std/assertions
diff --git a/compiler/ast.nim b/compiler/ast.nim
index 8d4511436..5ee9afa02 100644
--- a/compiler/ast.nim
+++ b/compiler/ast.nim
@@ -10,8 +10,10 @@
 # abstract syntax tree + symbol table
 
 import
-  lineinfos, hashes, options, ropes, idents, int128, tables, wordrecg
-from strutils import toLowerAscii
+  lineinfos, options, ropes, idents, int128, wordrecg
+
+import std/[tables, hashes]
+from std/strutils import toLowerAscii
 
 when defined(nimPreviewSlimSystem):
   import std/assertions
diff --git a/compiler/astalgo.nim b/compiler/astalgo.nim
index 1873d231f..720f6087f 100644
--- a/compiler/astalgo.nim
+++ b/compiler/astalgo.nim
@@ -12,10 +12,11 @@
 # the data structures here are used in various places of the compiler.
 
 import
-  ast, hashes, intsets, options, lineinfos, ropes, idents, rodutils,
+  ast, options, lineinfos, ropes, idents, rodutils,
   msgs
 
-import strutils except addf
+import std/[hashes, intsets]
+import std/strutils except addf
 
 when defined(nimPreviewSlimSystem):
   import std/assertions
@@ -408,7 +409,7 @@ proc symToYaml(conf: ConfigRef; n: PSym, indent: int = 0, maxRecDepth: int = - 1
   var marker = initIntSet()
   result = symToYamlAux(conf, n, marker, indent, maxRecDepth)
 
-import tables
+import std/tables
 
 const backrefStyle = "\e[90m"
 const enumStyle = "\e[34m"
diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim
index a591ce93b..4103e0afb 100644
--- a/compiler/ccgtypes.nim
+++ b/compiler/ccgtypes.nim
@@ -11,7 +11,7 @@
 
 # ------------------------- Name Mangling --------------------------------
 
-import sighashes, modulegraphs, strscans
+import sighashes, modulegraphs, std/strscans
 import ../dist/checksums/src/checksums/md5
 
 type
diff --git a/compiler/ccgutils.nim b/compiler/ccgutils.nim
index 87fed300b..bfb429f82 100644
--- a/compiler/ccgutils.nim
+++ b/compiler/ccgutils.nim
@@ -10,9 +10,11 @@
 # This module declares some helpers for the C code generator.
 
 import
-  ast, types, hashes, strutils, msgs, wordrecg,
+  ast, types, msgs, wordrecg,
   platform, trees, options, cgendata
 
+import std/[hashes, strutils]
+
 when defined(nimPreviewSlimSystem):
   import std/assertions
 
diff --git a/compiler/cgen.nim b/compiler/cgen.nim
index a2b2c429e..0011cb90e 100644
--- a/compiler/cgen.nim
+++ b/compiler/cgen.nim
@@ -10,11 +10,11 @@
 ## This module implements the C code generator.
 
 import
-  ast, astalgo, hashes, trees, platform, magicsys, extccomp, options, intsets,
+  ast, astalgo, trees, platform, magicsys, extccomp, options,
   nversion, nimsets, msgs, bitsets, idents, types,
-  ccgutils, os, ropes, math, wordrecg, treetab, cgmeth,
+  ccgutils, ropes, wordrecg, treetab, cgmeth,
   rodutils, renderer, cgendata, aliases,
-  lowerings, tables, sets, ndi, lineinfos, pathutils, transf,
+  lowerings, ndi, lineinfos, pathutils, transf,
   injectdestructors, astmsgs, modulepaths, backendpragmas
 
 from expanddefaults import caseObjDefaultBranch
@@ -27,10 +27,10 @@ when defined(nimPreviewSlimSystem):
 when not defined(leanCompiler):
   import spawn, semparallel
 
-import strutils except `%`, addf # collides with ropes.`%`
+import std/strutils except `%`, addf # collides with ropes.`%`
 
 from ic / ic import ModuleBackendFlag
-import dynlib
+import std/[dynlib, math, tables, sets, os, intsets, hashes]
 
 when not declared(dynlib.libCandidates):
   proc libCandidates(s: string, dest: var seq[string]) =
@@ -121,7 +121,7 @@ proc getModuleDllPath(m: BModule, module: int): Rope =
 proc getModuleDllPath(m: BModule, s: PSym): Rope =
   result = getModuleDllPath(m.g.modules[s.itemId.module])
 
-import macros
+import std/macros
 
 proc cgFormatValue(result: var string; value: string) =
   result.add value
diff --git a/compiler/cgendata.nim b/compiler/cgendata.nim
index 9cc146c4d..30d778bc2 100644
--- a/compiler/cgendata.nim
+++ b/compiler/cgendata.nim
@@ -10,8 +10,10 @@
 ## This module contains the data structures for the C code generation phase.
 
 import
-  ast, ropes, options, intsets,
-  tables, ndi, lineinfos, pathutils, modulegraphs, sets
+  ast, ropes, options,
+  ndi, lineinfos, pathutils, modulegraphs
+
+import std/[intsets, tables, sets]
 
 type
   TLabel* = Rope              # for the C generator a label is just a rope
diff --git a/compiler/cgmeth.nim b/compiler/cgmeth.nim
index ed8f33630..8ad6bf3f4 100644
--- a/compiler/cgmeth.nim
+++ b/compiler/cgmeth.nim
@@ -10,9 +10,12 @@
 ## This module implements code generation for methods.
 
 import
-  intsets, options, ast, msgs, idents, renderer, types, magicsys,
+  options, ast, msgs, idents, renderer, types, magicsys,
   sempass2, modulegraphs, lineinfos
 
+
+import std/intsets
+
 when defined(nimPreviewSlimSystem):
   import std/assertions
 
diff --git a/compiler/closureiters.nim b/compiler/closureiters.nim
index 15c627dcd..63e8d2fe9 100644
--- a/compiler/closureiters.nim
+++ b/compiler/closureiters.nim
@@ -134,7 +134,9 @@
 import
   ast, msgs, idents,
   renderer, magicsys, lowerings, lambdalifting, modulegraphs, lineinfos,
-  tables, options
+  options
+
+import std/tables
 
 when defined(nimPreviewSlimSystem):
   import std/assertions
diff --git a/compiler/cmdlinehelper.nim b/compiler/cmdlinehelper.nim
index e35e5d2db..031ad755e 100644
--- a/compiler/cmdlinehelper.nim
+++ b/compiler/cmdlinehelper.nim
@@ -11,7 +11,9 @@
 
 import
   options, idents, nimconf, extccomp, commands, msgs,
-  lineinfos, modulegraphs, condsyms, os, pathutils, parseopt
+  lineinfos, modulegraphs, condsyms, pathutils
+
+import std/[os, parseopt]
 
 proc prependCurDir*(f: AbsoluteFile): AbsoluteFile =
   when defined(unix):
diff --git a/compiler/commands.nim b/compiler/commands.nim
index 0e35cc3e8..e758ed09b 100644
--- a/compiler/commands.nim
+++ b/compiler/commands.nim
@@ -27,7 +27,9 @@ bootSwitch(usedNoGC, defined(nogc), "--gc:none")
 import std/[setutils, os, strutils, parseutils, parseopt, sequtils, strtabs]
 import
   msgs, options, nversion, condsyms, extccomp, platform,
-  wordrecg, nimblecmd, lineinfos, pathutils, pathnorm
+  wordrecg, nimblecmd, lineinfos, pathutils
+
+import std/pathnorm
 
 from ast import setUseIc, eqTypeFlags, tfGcSafe, tfNoSideEffect
 
diff --git a/compiler/concepts.nim b/compiler/concepts.nim
index 55088740c..d8b65720b 100644
--- a/compiler/concepts.nim
+++ b/compiler/concepts.nim
@@ -11,7 +11,9 @@
 ## for details. Note this is a first implementation and only the "Concept matching"
 ## section has been implemented.
 
-import ast, astalgo, semdata, lookups, lineinfos, idents, msgs, renderer, types, intsets
+import ast, astalgo, semdata, lookups, lineinfos, idents, msgs, renderer, types
+
+import std/intsets
 
 when defined(nimPreviewSlimSystem):
   import std/assertions
diff --git a/compiler/condsyms.nim b/compiler/condsyms.nim
index 520545a81..aa619c932 100644
--- a/compiler/condsyms.nim
+++ b/compiler/condsyms.nim
@@ -10,7 +10,7 @@
 # This module handles the conditional symbols.
 
 import
-  strtabs
+  std/strtabs
 
 from options import Feature
 from lineinfos import hintMin, hintMax, warnMin, warnMax
@@ -162,3 +162,4 @@ proc initDefines*(symbols: StringTableRef) =
   defineSymbol("nimHasNolineTooLong")
 
   defineSymbol("nimHasCastExtendedVm")
+  defineSymbol("nimHasWarnStdPrefix")
diff --git a/compiler/depends.nim b/compiler/depends.nim
index 84e66f780..638f1eb51 100644
--- a/compiler/depends.nim
+++ b/compiler/depends.nim
@@ -14,7 +14,7 @@ import options, ast, ropes, pathutils, msgs, lineinfos
 import modulegraphs
 
 import std/[os, parseutils]
-import strutils except addf
+import std/strutils except addf
 import std/private/globs
 
 when defined(nimPreviewSlimSystem):
diff --git a/compiler/dfa.nim b/compiler/dfa.nim
index 4cae9ec42..1511628dd 100644
--- a/compiler/dfa.nim
+++ b/compiler/dfa.nim
@@ -22,8 +22,9 @@
 ## "A Graph–Free Approach to Data–Flow Analysis" by Markus Mohnen.
 ## https://link.springer.com/content/pdf/10.1007/3-540-45937-5_6.pdf
 
-import ast, intsets, lineinfos, renderer, aliasanalysis
+import ast, lineinfos, renderer, aliasanalysis
 import std/private/asciitables
+import std/intsets
 
 when defined(nimPreviewSlimSystem):
   import std/assertions
diff --git a/compiler/docgen.nim b/compiler/docgen.nim
index 7edee1663..ea7cfad8c 100644
--- a/compiler/docgen.nim
+++ b/compiler/docgen.nim
@@ -15,15 +15,16 @@
 ## For corresponding users' documentation see [Nim DocGen Tools Guide].
 
 import
-  ast, strutils, strtabs, algorithm, sequtils, options, msgs, os, idents,
+  ast, options, msgs, idents,
   wordrecg, syntaxes, renderer, lexer,
   packages/docutils/[rst, rstidx, rstgen, dochelpers],
-  json, xmltree, trees, types,
-  typesrenderer, astalgo, lineinfos, intsets,
-  pathutils, tables, nimpaths, renderverbatim, osproc, packages
+  trees, types,
+  typesrenderer, astalgo, lineinfos,
+  pathutils, nimpaths, renderverbatim, packages
 import packages/docutils/rstast except FileIndex, TLineInfo
 
-from uri import encodeUrl
+import std/[os, strutils, strtabs, algorithm, json, osproc, tables, intsets, xmltree, sequtils]
+from std/uri import encodeUrl
 from nodejs import findNodeJs
 
 when defined(nimPreviewSlimSystem):
diff --git a/compiler/errorhandling.nim b/compiler/errorhandling.nim
index a8361105e..2ad0f8806 100644
--- a/compiler/errorhandling.nim
+++ b/compiler/errorhandling.nim
@@ -10,7 +10,8 @@
 ## This module contains support code for new-styled error
 ## handling via an `nkError` node kind.
 
-import ast, renderer, options, strutils, types
+import ast, renderer, options, types
+import std/strutils
 
 when defined(nimPreviewSlimSystem):
   import std/assertions
diff --git a/compiler/evalffi.nim b/compiler/evalffi.nim
index 3f386f76e..ab26ca1bb 100644
--- a/compiler/evalffi.nim
+++ b/compiler/evalffi.nim
@@ -9,10 +9,12 @@
 
 ## This file implements the FFI part of the evaluator for Nim code.
 
-import ast, types, options, tables, dynlib, msgs, lineinfos
-from os import getAppFilename
+import ast, types, options, msgs, lineinfos
+from std/os import getAppFilename
 import libffi/libffi
 
+import std/[tables, dynlib]
+
 when defined(windows):
   const libcDll = "msvcrt.dll"
 elif defined(linux):
diff --git a/compiler/evaltempl.nim b/compiler/evaltempl.nim
index a5d888858..5ebb4fa55 100644
--- a/compiler/evaltempl.nim
+++ b/compiler/evaltempl.nim
@@ -9,8 +9,8 @@
 
 ## Template evaluation engine. Now hygienic.
 
-import
-  strutils, options, ast, astalgo, msgs, renderer, lineinfos, idents, trees
+import options, ast, astalgo, msgs, renderer, lineinfos, idents, trees
+import std/strutils
 
 type
   TemplCtx = object
diff --git a/compiler/filter_tmpl.nim b/compiler/filter_tmpl.nim
index d04388b96..921a94b31 100644
--- a/compiler/filter_tmpl.nim
+++ b/compiler/filter_tmpl.nim
@@ -10,9 +10,11 @@
 # This module implements Nim's standard template filter.
 
 import
-  llstream, strutils, ast, msgs, options,
+  llstream, ast, msgs, options,
   filters, lineinfos, pathutils
 
+import std/strutils
+
 type
   TParseState = enum
     psDirective, psTempl
diff --git a/compiler/filters.nim b/compiler/filters.nim
index 8d8af6b1c..3cd56e3be 100644
--- a/compiler/filters.nim
+++ b/compiler/filters.nim
@@ -10,9 +10,11 @@
 # This module implements Nim's simple filters and helpers for filters.
 
 import
-  llstream, idents, strutils, ast, msgs, options,
+  llstream, idents, ast, msgs, options,
   renderer, pathutils
 
+import std/strutils
+
 proc invalidPragma(conf: ConfigRef; n: PNode) =
   localError(conf, n.info,
       "'$1' not allowed here" % renderTree(n, {renderNoComments}))
diff --git a/compiler/gorgeimpl.nim b/compiler/gorgeimpl.nim
index fb0fafc98..da911c84c 100644
--- a/compiler/gorgeimpl.nim
+++ b/compiler/gorgeimpl.nim
@@ -9,8 +9,9 @@
 
 ## Module that implements ``gorge`` for the compiler.
 
-import msgs, os, osproc, streams, options,
-  lineinfos, pathutils
+import msgs, options, lineinfos, pathutils
+
+import std/[os, osproc, streams]
 
 when defined(nimPreviewSlimSystem):
   import std/syncio
diff --git a/compiler/guards.nim b/compiler/guards.nim
index 1366a2382..21c7cd045 100644
--- a/compiler/guards.nim
+++ b/compiler/guards.nim
@@ -870,7 +870,7 @@ template isSub(x): untyped = x.getMagic in someSub
 template isVal(x): untyped = x.kind in {nkCharLit..nkUInt64Lit}
 template isIntVal(x, y): untyped = x.intVal == y
 
-import macros
+import std/macros
 
 macro `=~`(x: PNode, pat: untyped): bool =
   proc m(x, pat, conds: NimNode) =
diff --git a/compiler/ic/bitabs.nim b/compiler/ic/bitabs.nim
index edbaeb240..65b1e5a0e 100644
--- a/compiler/ic/bitabs.nim
+++ b/compiler/ic/bitabs.nim
@@ -1,7 +1,8 @@
 ## A BiTable is a table that can be seen as an optimized pair
 ## of `(Table[LitId, Val], Table[Val, LitId])`.
 
-import hashes, rodfiles
+import std/hashes
+import rodfiles
 
 when defined(nimPreviewSlimSystem):
   import std/assertions
diff --git a/compiler/ic/cbackend.nim b/compiler/ic/cbackend.nim
index a1922c812..97462f095 100644
--- a/compiler/ic/cbackend.nim
+++ b/compiler/ic/cbackend.nim
@@ -18,7 +18,7 @@
 ## also doing cross-module dependency tracking and DCE that we don't need
 ## anymore. DCE is now done as prepass over the entire packed module graph.
 
-import std/packedsets, algorithm, tables
+import std/[packedsets, algorithm, tables]
 
 when defined(nimPreviewSlimSystem):
   import std/assertions
diff --git a/compiler/ic/ic.nim b/compiler/ic/ic.nim
index 8b0a31054..4d02822b2 100644
--- a/compiler/ic/ic.nim
+++ b/compiler/ic/ic.nim
@@ -7,12 +7,12 @@
 #    distribution, for details about the copyright.
 #
 
-import hashes, tables, intsets
+import std/[hashes, tables, intsets]
 import packed_ast, bitabs, rodfiles
 import ".." / [ast, idents, lineinfos, msgs, ropes, options,
   pathutils, condsyms, packages, modulepaths]
 #import ".." / [renderer, astalgo]
-from os import removeFile, isAbsolute
+from std/os import removeFile, isAbsolute
 
 import ../../dist/checksums/src/checksums/sha1
 
diff --git a/compiler/ic/integrity.nim b/compiler/ic/integrity.nim
index d341fd653..ed87ae59d 100644
--- a/compiler/ic/integrity.nim
+++ b/compiler/ic/integrity.nim
@@ -10,7 +10,7 @@
 ## Integrity checking for a set of .rod files.
 ## The set must cover a complete Nim project.
 
-import sets
+import std/sets
 
 when defined(nimPreviewSlimSystem):
   import std/assertions
diff --git a/compiler/ic/navigator.nim b/compiler/ic/navigator.nim
index ab49b3b7a..aea5e12e7 100644
--- a/compiler/ic/navigator.nim
+++ b/compiler/ic/navigator.nim
@@ -11,9 +11,9 @@
 ## IDE-like features. It uses the set of .rod files to accomplish
 ## its task. The set must cover a complete Nim project.
 
-import sets
+import std/sets
 
-from os import nil
+from std/os import nil
 from std/private/miscdollars import toLocation
 
 when defined(nimPreviewSlimSystem):
diff --git a/compiler/ic/packed_ast.nim b/compiler/ic/packed_ast.nim
index b87348c5a..e7443c3c7 100644
--- a/compiler/ic/packed_ast.nim
+++ b/compiler/ic/packed_ast.nim
@@ -12,7 +12,7 @@
 ## use this representation directly in all the transformations,
 ## it is superior.
 
-import hashes, tables, strtabs
+import std/[hashes, tables, strtabs]
 import bitabs
 import ".." / [ast, options]
 
diff --git a/compiler/ic/replayer.nim b/compiler/ic/replayer.nim
index 8eee0b3d8..3bbe4fa31 100644
--- a/compiler/ic/replayer.nim
+++ b/compiler/ic/replayer.nim
@@ -14,7 +14,7 @@
 import ".." / [ast, modulegraphs, trees, extccomp, btrees,
   msgs, lineinfos, pathutils, options, cgmeth]
 
-import tables
+import std/tables
 
 when defined(nimPreviewSlimSystem):
   import std/assertions
diff --git a/compiler/ic/rodfiles.nim b/compiler/ic/rodfiles.nim
index 3505bfdfb..db520527b 100644
--- a/compiler/ic/rodfiles.nim
+++ b/compiler/ic/rodfiles.nim
@@ -14,7 +14,7 @@
 ##     compiler works and less a storage format, you're probably looking for
 ##     the `ic` or `packed_ast` modules to understand the logical format.
 
-from typetraits import supportsCopyMem
+from std/typetraits import supportsCopyMem
 
 when defined(nimPreviewSlimSystem):
   import std/[syncio, assertions]
diff --git a/compiler/idents.nim b/compiler/idents.nim
index f36ce09f3..34177e76d 100644
--- a/compiler/idents.nim
+++ b/compiler/idents.nim
@@ -11,8 +11,8 @@
 # An identifier is a shared immutable string that can be compared by its
 # id. This module is essential for the compiler's performance.
 
-import
-  hashes, wordrecg
+import wordrecg
+import std/hashes
 
 when defined(nimPreviewSlimSystem):
   import std/assertions
diff --git a/compiler/importer.nim b/compiler/importer.nim
index dcdd0bb49..ff1f9f63e 100644
--- a/compiler/importer.nim
+++ b/compiler/importer.nim
@@ -10,11 +10,12 @@
 ## This module implements the symbol importing mechanism.
 
 import
-  intsets, ast, astalgo, msgs, options, idents, lookups,
-  semdata, modulepaths, sigmatch, lineinfos, sets,
-  modulegraphs, wordrecg, tables
-from strutils import `%`
-from sequtils import addUnique
+  ast, astalgo, msgs, options, idents, lookups,
+  semdata, modulepaths, sigmatch, lineinfos,
+  modulegraphs, wordrecg
+from std/strutils import `%`, startsWith
+from std/sequtils import addUnique
+import std/[sets, tables, intsets]
 
 when defined(nimPreviewSlimSystem):
   import std/assertions
@@ -301,6 +302,10 @@ proc myImportModule(c: PContext, n: var PNode, importStmtResult: PNode): PSym =
       var prefix = ""
       if realModule.constraint != nil: prefix = realModule.constraint.strVal & "; "
       message(c.config, n.info, warnDeprecated, prefix & realModule.name.s & " is deprecated")
+    let moduleName = getModuleName(c.config, n)
+    if belongsToStdlib(c.graph, result) and not startsWith(moduleName, stdPrefix) and
+        not startsWith(moduleName, "system/") and not startsWith(moduleName, "packages/"):
+      message(c.config, n.info, warnStdPrefix, realModule.name.s)
     suggestSym(c.graph, n.info, result, c.graph.usageSym, false)
     importStmtResult.add newSymNode(result, n.info)
     #newStrNode(toFullPath(c.config, f), n.info)
diff --git a/compiler/injectdestructors.nim b/compiler/injectdestructors.nim
index a5ec6c21a..6b3fdeca5 100644
--- a/compiler/injectdestructors.nim
+++ b/compiler/injectdestructors.nim
@@ -14,11 +14,13 @@
 ## See doc/destructors.rst for a spec of the implemented rewrite rules
 
 import
-  intsets, strtabs, ast, astalgo, msgs, renderer, magicsys, types, idents,
-  strutils, options, lowerings, tables, modulegraphs,
+  ast, astalgo, msgs, renderer, magicsys, types, idents,
+  options, lowerings, modulegraphs,
   lineinfos, parampatterns, sighashes, liftdestructors, optimizer,
   varpartitions, aliasanalysis, dfa, wordrecg
 
+import std/[strtabs, tables, strutils, intsets]
+
 when defined(nimPreviewSlimSystem):
   import std/assertions
 
diff --git a/compiler/int128.nim b/compiler/int128.nim
index 18e751f98..ca06a3a97 100644
--- a/compiler/int128.nim
+++ b/compiler/int128.nim
@@ -3,7 +3,7 @@
 ## hold all from `low(BiggestInt)` to `high(BiggestUInt)`, This
 ## type is for that purpose.
 
-from math import trunc
+from std/math import trunc
 
 when defined(nimPreviewSlimSystem):
   import std/assertions
@@ -358,7 +358,7 @@ proc `*`*(lhs, rhs: Int128): Int128 =
 proc `*=`*(a: var Int128, b: Int128) =
   a = a * b
 
-import bitops
+import std/bitops
 
 proc fastLog2*(a: Int128): int =
   result = 0
diff --git a/compiler/isolation_check.nim b/compiler/isolation_check.nim
index 5fd1b8d51..b11d64a6b 100644
--- a/compiler/isolation_check.nim
+++ b/compiler/isolation_check.nim
@@ -11,7 +11,9 @@
 ## https://github.com/nim-lang/RFCs/issues/244 for more details.
 
 import
-  ast, types, renderer, intsets
+  ast, types, renderer
+
+import std/intsets
 
 when defined(nimPreviewSlimSystem):
   import std/assertions
diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim
index 6b57c097f..74edb4694 100644
--- a/compiler/jsgen.nim
+++ b/compiler/jsgen.nim
@@ -37,8 +37,8 @@ import
 
 import pipelineutils
 
-import json, sets, math, tables, intsets
-import strutils except addf
+import std/[json, sets, math, tables, intsets]
+import std/strutils except addf
 
 when defined(nimPreviewSlimSystem):
   import std/[assertions, syncio]
diff --git a/compiler/lambdalifting.nim b/compiler/lambdalifting.nim
index fdba7ba3d..248effcaf 100644
--- a/compiler/lambdalifting.nim
+++ b/compiler/lambdalifting.nim
@@ -10,10 +10,12 @@
 # This file implements lambda lifting for the transformator.
 
 import
-  intsets, strutils, options, ast, astalgo, msgs,
-  idents, renderer, types, magicsys, lowerings, tables, modulegraphs, lineinfos,
+  options, ast, astalgo, msgs,
+  idents, renderer, types, magicsys, lowerings, modulegraphs, lineinfos,
   transf, liftdestructors, typeallowed
 
+import std/[strutils, tables, intsets]
+
 when defined(nimPreviewSlimSystem):
   import std/assertions
 
diff --git a/compiler/lexer.nim b/compiler/lexer.nim
index 93a5f8040..5aed19636 100644
--- a/compiler/lexer.nim
+++ b/compiler/lexer.nim
@@ -16,8 +16,10 @@
 # DOS or Macintosh text files, even when it is not the native format.
 
 import
-  hashes, options, msgs, strutils, platform, idents, nimlexbase, llstream,
-  wordrecg, lineinfos, pathutils, parseutils
+  options, msgs, platform, idents, nimlexbase, llstream,
+  wordrecg, lineinfos, pathutils
+
+import std/[hashes, parseutils, strutils]
 
 when defined(nimPreviewSlimSystem):
   import std/[assertions, formatfloat]
diff --git a/compiler/liftdestructors.nim b/compiler/liftdestructors.nim
index a73df046e..ea0d6e6f8 100644
--- a/compiler/liftdestructors.nim
+++ b/compiler/liftdestructors.nim
@@ -11,8 +11,9 @@
 ## (`=sink`, `=copy`, `=destroy`, `=deepCopy`, `=wasMoved`, `=dup`).
 
 import modulegraphs, lineinfos, idents, ast, renderer, semdata,
-  sighashes, lowerings, options, types, msgs, magicsys, tables, ccgutils
+  sighashes, lowerings, options, types, msgs, magicsys, ccgutils
 
+import std/tables
 from trees import isCaseObj
 
 when defined(nimPreviewSlimSystem):
diff --git a/compiler/liftlocals.nim b/compiler/liftlocals.nim
index 58c6189d4..aaa0707e0 100644
--- a/compiler/liftlocals.nim
+++ b/compiler/liftlocals.nim
@@ -10,9 +10,11 @@
 ## This module implements the '.liftLocals' pragma.
 
 import
-  strutils, options, ast, msgs,
+  options, ast, msgs,
   idents, renderer, types, lowerings, lineinfos
 
+import std/strutils
+
 from pragmas import getPragmaVal
 from wordrecg import wLiftLocals
 
diff --git a/compiler/lineinfos.nim b/compiler/lineinfos.nim
index 544c5295c..ef3222288 100644
--- a/compiler/lineinfos.nim
+++ b/compiler/lineinfos.nim
@@ -10,7 +10,8 @@
 ## This module contains the `TMsgKind` enum as well as the
 ## `TLineInfo` object.
 
-import ropes, tables, pathutils, hashes
+import ropes, pathutils
+import std/[hashes, tables]
 
 const
   explanationsBaseUrl* = "https://nim-lang.github.io/Nim"
@@ -91,6 +92,7 @@ type
     warnStmtListLambda = "StmtListLambda",
     warnBareExcept = "BareExcept",
     warnImplicitDefaultValue = "ImplicitDefaultValue",
+    warnStdPrefix = "StdPrefix"
     warnUser = "User",
     # hints
     hintSuccess = "Success", hintSuccessX = "SuccessX",
@@ -194,6 +196,7 @@ const
     warnStmtListLambda: "statement list expression assumed to be anonymous proc; this is deprecated, use `do (): ...` or `proc () = ...` instead",
     warnBareExcept: "$1",
     warnImplicitDefaultValue: "$1",
+    warnStdPrefix: "$1 needs the 'std' prefix",
     warnUser: "$1",
     hintSuccess: "operation successful: $#",
     # keep in sync with `testament.isSuccess`
@@ -249,7 +252,7 @@ type
 
 proc computeNotesVerbosity(): array[0..3, TNoteKinds] =
   result = default(array[0..3, TNoteKinds])
-  result[3] = {low(TNoteKind)..high(TNoteKind)} - {warnObservableStores, warnResultUsed, warnAnyEnumConv, warnBareExcept}
+  result[3] = {low(TNoteKind)..high(TNoteKind)} - {warnObservableStores, warnResultUsed, warnAnyEnumConv, warnBareExcept, warnStdPrefix}
   result[2] = result[3] - {hintStackTrace, hintExtendedContext, hintDeclaredLoc, hintProcessingStmt}
   result[1] = result[2] - {warnProveField, warnProveIndex,
     warnGcUnsafe, hintPath, hintDependency, hintCodeBegin, hintCodeEnd,
diff --git a/compiler/lookups.nim b/compiler/lookups.nim
index 2bdf3a1e0..1a60de7e5 100644
--- a/compiler/lookups.nim
+++ b/compiler/lookups.nim
@@ -14,8 +14,10 @@ when defined(nimPreviewSlimSystem):
   import std/assertions
 
 import
-  intsets, ast, astalgo, idents, semdata, types, msgs, options,
-  renderer, lineinfos, modulegraphs, astmsgs, sets, wordrecg
+  ast, astalgo, idents, semdata, types, msgs, options,
+  renderer, lineinfos, modulegraphs, astmsgs, wordrecg
+
+import std/[intsets, sets]
 
 proc ensureNoMissingOrUnusedSymbols(c: PContext; scope: PScope)
 
@@ -464,7 +466,7 @@ proc mergeShadowScope*(c: PContext) =
       c.addInterfaceDecl(sym)
 
 
-import std/editdistance, heapqueue
+import std/[editdistance, heapqueue]
 
 type SpellCandidate = object
   dist: int
diff --git a/compiler/modulegraphs.nim b/compiler/modulegraphs.nim
index c450af50f..325c0adb1 100644
--- a/compiler/modulegraphs.nim
+++ b/compiler/modulegraphs.nim
@@ -11,7 +11,7 @@
 ## represents a complete Nim project. Single modules can either be kept in RAM
 ## or stored in a rod-file.
 
-import intsets, tables, hashes
+import std/[intsets, tables, hashes]
 import ../dist/checksums/src/checksums/md5
 import ast, astalgo, options, lineinfos,idents, btrees, ropes, msgs, pathutils, packages
 import ic / [packed_ast, ic]
diff --git a/compiler/modulepaths.nim b/compiler/modulepaths.nim
index e80ea3fa6..c29ed6793 100644
--- a/compiler/modulepaths.nim
+++ b/compiler/modulepaths.nim
@@ -7,9 +7,11 @@
 #    distribution, for details about the copyright.
 #
 
-import ast, renderer, strutils, msgs, options, idents, os, lineinfos,
+import ast, renderer, msgs, options, idents, lineinfos,
   pathutils
 
+import std/[strutils, os]
+
 proc getModuleName*(conf: ConfigRef; n: PNode): string =
   # This returns a short relative module name without the nim extension
   # e.g. like "system", "importer" or "somepath/module"
diff --git a/compiler/nilcheck.nim b/compiler/nilcheck.nim
index 96e096770..1713a888f 100644
--- a/compiler/nilcheck.nim
+++ b/compiler/nilcheck.nim
@@ -7,8 +7,8 @@
 #    distribution, for details about the copyright.
 #
 
-import ast, renderer, intsets, tables, msgs, options, lineinfos, strformat, idents, treetab, hashes
-import sequtils, strutils, sets
+import ast, renderer, msgs, options, lineinfos, idents, treetab
+import std/[intsets, tables, sequtils, strutils, sets, strformat, hashes]
 
 when defined(nimPreviewSlimSystem):
   import std/assertions
diff --git a/compiler/nim.cfg b/compiler/nim.cfg
index 040053685..e4425065e 100644
--- a/compiler/nim.cfg
+++ b/compiler/nim.cfg
@@ -41,6 +41,7 @@ define:useStdoutAsStdmsg
 @end
 
 @if nimHasWarnBareExcept:
+  warning[BareExcept]:on
   warningAserror[BareExcept]:on
 @end
 
@@ -51,3 +52,7 @@ define:useStdoutAsStdmsg
   warningAsError[ProveInit]:on
 @end
 
+@if nimHasWarnStdPrefix:
+  warning[StdPrefix]:on
+  warningAsError[StdPrefix]:on
+@end
diff --git a/compiler/nim.nim b/compiler/nim.nim
index 7ec6f3e77..184303f8e 100644
--- a/compiler/nim.nim
+++ b/compiler/nim.nim
@@ -28,7 +28,7 @@ import
   commands, options, msgs, extccomp, main, idents, lineinfos, cmdlinehelper,
   pathutils, modulegraphs
 
-from browsers import openDefaultBrowser
+from std/browsers import openDefaultBrowser
 from nodejs import findNodeJs
 
 when hasTinyCBackend:
diff --git a/compiler/nimblecmd.nim b/compiler/nimblecmd.nim
index 97a66f1cd..4b6e22bc9 100644
--- a/compiler/nimblecmd.nim
+++ b/compiler/nimblecmd.nim
@@ -9,8 +9,9 @@
 
 ## Implements some helper procs for Nimble (Nim's package manager) support.
 
-import parseutils, strutils, os, options, msgs, sequtils, lineinfos, pathutils,
-  tables
+import options, msgs, lineinfos, pathutils
+
+import std/[parseutils, strutils, os, tables, sequtils]
 
 when defined(nimPreviewSlimSystem):
   import std/[syncio, assertions]
diff --git a/compiler/nimconf.nim b/compiler/nimconf.nim
index 78215d281..3a811a106 100644
--- a/compiler/nimconf.nim
+++ b/compiler/nimconf.nim
@@ -10,8 +10,10 @@
 # This module handles the reading of the config file.
 
 import
-  llstream, commands, os, strutils, msgs, lexer, ast,
-  options, idents, wordrecg, strtabs, lineinfos, pathutils, scriptconfig
+  llstream, commands, msgs, lexer, ast,
+  options, idents, wordrecg, lineinfos, pathutils, scriptconfig
+
+import std/[os, strutils, strtabs]
 
 when defined(nimPreviewSlimSystem):
   import std/syncio
diff --git a/compiler/nimlexbase.nim b/compiler/nimlexbase.nim
index 3bc9af9c9..6708b57f8 100644
--- a/compiler/nimlexbase.nim
+++ b/compiler/nimlexbase.nim
@@ -12,8 +12,9 @@
 # handling that exists! Only at line endings checks are necessary
 # if the buffer needs refilling.
 
-import
-  llstream, strutils
+import llstream
+
+import std/strutils
 
 when defined(nimPreviewSlimSystem):
   import std/assertions
diff --git a/compiler/nimpaths.nim b/compiler/nimpaths.nim
index 3756f956b..0a66c3c1f 100644
--- a/compiler/nimpaths.nim
+++ b/compiler/nimpaths.nim
@@ -17,7 +17,7 @@ interpolation variables:
 Unstable API
 ]##
 
-import os, strutils
+import std/[os, strutils]
 
 when defined(nimPreviewSlimSystem):
   import std/assertions
diff --git a/compiler/nir/nir.nim b/compiler/nir/nir.nim
index c4fb5322d..1efa6719a 100644
--- a/compiler/nir/nir.nim
+++ b/compiler/nir/nir.nim
@@ -10,7 +10,7 @@
 ## Nim Intermediate Representation, designed to capture all of Nim's semantics without losing too much
 ## precious information. Can easily be translated into C. And to JavaScript, hopefully.
 
-from os import addFileExt, `/`, createDir
+from std/os import addFileExt, `/`, createDir
 
 import std / assertions
 import ".." / [ast, modulegraphs, renderer, transf, options, msgs, lineinfos]
diff --git a/compiler/nir/stringcases.nim b/compiler/nir/stringcases.nim
index 9417d613d..afdf8fda4 100644
--- a/compiler/nir/stringcases.nim
+++ b/compiler/nir/stringcases.nim
@@ -49,7 +49,7 @@ afterCase: ...
 # Every string of length > position for which s[position] <= char is in one
 # set else it is in the other set.
 
-from sequtils import addUnique
+from std/sequtils import addUnique
 
 type
   Key = (LitId, LabelId)
diff --git a/compiler/nodejs.nim b/compiler/nodejs.nim
index c1feb196a..9753e1c99 100644
--- a/compiler/nodejs.nim
+++ b/compiler/nodejs.nim
@@ -1,4 +1,4 @@
-import os
+import std/os
 
 proc findNodeJs*(): string {.inline.} =
   ## Find NodeJS executable and return it as a string.
diff --git a/compiler/optimizer.nim b/compiler/optimizer.nim
index 7e46f3d0b..d39d598ba 100644
--- a/compiler/optimizer.nim
+++ b/compiler/optimizer.nim
@@ -12,11 +12,11 @@
 ## - recognize "all paths lead to 'wasMoved(x)'"
 
 import
-  ast, renderer, idents, intsets
+  ast, renderer, idents
 
 from trees import exprStructuralEquivalent
 
-import std/strutils
+import std/[strutils, intsets]
 
 const
   nfMarkForDeletion = nfNone # faster than a lookup table
diff --git a/compiler/options.nim b/compiler/options.nim
index b36f72693..f2d93a9b3 100644
--- a/compiler/options.nim
+++ b/compiler/options.nim
@@ -8,11 +8,12 @@
 #
 
 import
-  os, strutils, strtabs, sets, lineinfos, platform,
-  prefixmatches, pathutils, nimpaths, tables
+  lineinfos, platform,
+  prefixmatches, pathutils, nimpaths
 
-from terminal import isatty
-from times import utc, fromUnix, local, getTime, format, DateTime
+import std/[tables, os, strutils, strtabs, sets]
+from std/terminal import isatty
+from std/times import utc, fromUnix, local, getTime, format, DateTime
 from std/private/globs import nativeToUnixPath
 
 when defined(nimPreviewSlimSystem):
@@ -890,7 +891,7 @@ const stdlibDirs* = [
 
 const
   pkgPrefix = "pkg/"
-  stdPrefix = "std/"
+  stdPrefix* = "std/"
 
 proc getRelativePathFromConfigPath*(conf: ConfigRef; f: AbsoluteFile, isTitle = false): RelativeFile =
   result = RelativeFile("")
diff --git a/compiler/parampatterns.nim b/compiler/parampatterns.nim
index 98f5099d6..84c2980c4 100644
--- a/compiler/parampatterns.nim
+++ b/compiler/parampatterns.nim
@@ -10,9 +10,11 @@
 ## This module implements the pattern matching features for term rewriting
 ## macro support.
 
-import strutils, ast, types, msgs, idents, renderer, wordrecg, trees,
+import ast, types, msgs, idents, renderer, wordrecg, trees,
   options
 
+import std/strutils
+
 # we precompile the pattern here for efficiency into some internal
 # stack based VM :-) Why? Because it's fun; I did no benchmarks to see if that
 # actually improves performance.
diff --git a/compiler/parser.nim b/compiler/parser.nim
index 7caeca95e..20f6868cd 100644
--- a/compiler/parser.nim
+++ b/compiler/parser.nim
@@ -49,9 +49,11 @@ when isMainModule or defined(nimTestGrammar):
     checkGrammarFile()
 
 import
-  llstream, lexer, idents, strutils, ast, msgs, options, lineinfos,
+  llstream, lexer, idents, ast, msgs, options, lineinfos,
   pathutils
 
+import std/strutils
+
 when defined(nimpretty):
   import layouter
 
diff --git a/compiler/pathutils.nim b/compiler/pathutils.nim
index d9779deab..5f6212bb2 100644
--- a/compiler/pathutils.nim
+++ b/compiler/pathutils.nim
@@ -10,7 +10,7 @@
 ## Path handling utilities for Nim. Strictly typed code in order
 ## to avoid the never ending time sink in getting path handling right.
 
-import os, pathnorm, strutils
+import std/[os, pathnorm, strutils]
 
 when defined(nimPreviewSlimSystem):
   import std/[syncio, assertions]
diff --git a/compiler/platform.nim b/compiler/platform.nim
index 613ebf7ec..03d0cc461 100644
--- a/compiler/platform.nim
+++ b/compiler/platform.nim
@@ -14,7 +14,7 @@
 # Feel free to test for your excentric platform!
 
 import
-  strutils
+  std/strutils
 
 when defined(nimPreviewSlimSystem):
   import std/assertions
diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim
index e6867aa5d..53b4f53a8 100644
--- a/compiler/pragmas.nim
+++ b/compiler/pragmas.nim
@@ -10,10 +10,12 @@
 # This module implements semantic checking for pragmas
 
 import
-  os, condsyms, ast, astalgo, idents, semdata, msgs, renderer,
-  wordrecg, ropes, options, strutils, extccomp, math, magicsys, trees,
+  condsyms, ast, astalgo, idents, semdata, msgs, renderer,
+  wordrecg, ropes, options, extccomp, magicsys, trees,
   types, lookups, lineinfos, pathutils, linter, modulepaths
 
+import std/[os, math, strutils]
+
 when defined(nimPreviewSlimSystem):
   import std/assertions
 
diff --git a/compiler/prefixmatches.nim b/compiler/prefixmatches.nim
index 71ae9a844..bfbe3d888 100644
--- a/compiler/prefixmatches.nim
+++ b/compiler/prefixmatches.nim
@@ -7,7 +7,7 @@
 #    distribution, for details about the copyright.
 #
 
-from strutils import toLowerAscii
+from std/strutils import toLowerAscii
 
 type
   PrefixMatch* {.pure.} = enum
diff --git a/compiler/procfind.nim b/compiler/procfind.nim
index 0bdb3dae6..468879ba2 100644
--- a/compiler/procfind.nim
+++ b/compiler/procfind.nim
@@ -11,7 +11,9 @@
 # This is needed for proper handling of forward declarations.
 
 import
-  ast, astalgo, msgs, semdata, types, trees, strutils, lookups
+  ast, astalgo, msgs, semdata, types, trees, lookups
+
+import std/strutils
 
 proc equalGenericParams(procA, procB: PNode): bool =
   if procA.len != procB.len: return false
diff --git a/compiler/renderer.nim b/compiler/renderer.nim
index 3a6d0ae65..43ac91e92 100644
--- a/compiler/renderer.nim
+++ b/compiler/renderer.nim
@@ -14,7 +14,9 @@
 {.used.}
 
 import
-  lexer, options, idents, strutils, ast, msgs, lineinfos, wordrecg
+  lexer, options, idents, ast, msgs, lineinfos, wordrecg
+
+import std/[strutils]
 
 when defined(nimPreviewSlimSystem):
   import std/[syncio, assertions, formatfloat]
diff --git a/compiler/renderverbatim.nim b/compiler/renderverbatim.nim
index 00d546198..c12595156 100644
--- a/compiler/renderverbatim.nim
+++ b/compiler/renderverbatim.nim
@@ -1,4 +1,4 @@
-import strutils
+import std/strutils
 
 import ast, options, msgs
 
diff --git a/compiler/reorder.nim b/compiler/reorder.nim
index aedebc7d4..f5ec0b2d3 100644
--- a/compiler/reorder.nim
+++ b/compiler/reorder.nim
@@ -1,9 +1,11 @@
 
 import
-  intsets, ast, idents, algorithm, renderer, strutils,
+  ast, idents, renderer,
   msgs, modulegraphs, syntaxes, options, modulepaths,
   lineinfos
 
+import std/[algorithm, strutils, intsets]
+
 when defined(nimPreviewSlimSystem):
   import std/assertions
 
diff --git a/compiler/rodutils.nim b/compiler/rodutils.nim
index ed5126859..e1b56800c 100644
--- a/compiler/rodutils.nim
+++ b/compiler/rodutils.nim
@@ -8,7 +8,7 @@
 #
 
 ## Serialization utilities for the compiler.
-import strutils, math
+import std/[strutils, math]
 
 when defined(nimPreviewSlimSystem):
   import std/assertions
diff --git a/compiler/scriptconfig.nim b/compiler/scriptconfig.nim
index c89767296..e3d2bcd45 100644
--- a/compiler/scriptconfig.nim
+++ b/compiler/scriptconfig.nim
@@ -13,14 +13,16 @@
 import
   ast, modules, idents, condsyms,
   options, llstream, vm, vmdef, commands,
-  os, times, osproc, wordrecg, strtabs, modulegraphs,
+  wordrecg, modulegraphs,
   pathutils, pipelines
 
 when defined(nimPreviewSlimSystem):
   import std/[syncio, assertions]
 
+import std/[strtabs, os, times, osproc]
+
 # we support 'cmpIgnoreStyle' natively for efficiency:
-from strutils import cmpIgnoreStyle, contains
+from std/strutils import cmpIgnoreStyle, contains
 
 proc listDirs(a: VmArgs, filter: set[PathComponent]) =
   let dir = getString(a, 0)
diff --git a/compiler/sem.nim b/compiler/sem.nim
index 55c6a427f..1908b5a0d 100644
--- a/compiler/sem.nim
+++ b/compiler/sem.nim
@@ -9,19 +9,18 @@
 
 # This module implements the semantic checking pass.
 
-import tables
-
 import
-  ast, strutils, options, astalgo, trees,
-  wordrecg, ropes, msgs, idents, renderer, types, platform, math,
+  ast, options, astalgo, trees,
+  wordrecg, ropes, msgs, idents, renderer, types, platform,
   magicsys, nversion, nimsets, semfold, modulepaths, importer,
   procfind, lookups, pragmas, semdata, semtypinst, sigmatch,
-  intsets, transf, vmdef, vm, aliases, cgmeth, lambdalifting,
+  transf, vmdef, vm, aliases, cgmeth, lambdalifting,
   evaltempl, patterns, parampatterns, sempass2, linter, semmacrosanity,
-  lowerings, plugins/active, lineinfos, strtabs, int128,
+  lowerings, plugins/active, lineinfos, int128,
   isolation_check, typeallowed, modulegraphs, enumtostr, concepts, astmsgs,
   extccomp
 
+import std/[strtabs, math, tables, intsets, strutils]
 
 when not defined(leanCompiler):
   import spawn
diff --git a/compiler/semdata.nim b/compiler/semdata.nim
index 32e557f18..91b15d5c7 100644
--- a/compiler/semdata.nim
+++ b/compiler/semdata.nim
@@ -9,14 +9,14 @@
 
 ## This module contains the data structures for the semantic checking phase.
 
-import tables
+import std/[tables, intsets, sets]
 
 when defined(nimPreviewSlimSystem):
   import std/assertions
 
 import
-  intsets, options, ast, astalgo, msgs, idents, renderer,
-  magicsys, vmdef, modulegraphs, lineinfos, sets, pathutils
+  options, ast, astalgo, msgs, idents, renderer,
+  magicsys, vmdef, modulegraphs, lineinfos, pathutils
 
 import ic / ic
 
diff --git a/compiler/semfold.nim b/compiler/semfold.nim
index f1a1c8a82..e722f932f 100644
--- a/compiler/semfold.nim
+++ b/compiler/semfold.nim
@@ -11,10 +11,11 @@
 # and evaluation phase
 
 import
-  strutils, options, ast, trees, nimsets,
-  platform, math, msgs, idents, renderer, types,
-  commands, magicsys, modulegraphs, strtabs, lineinfos, wordrecg
+  options, ast, trees, nimsets,
+  platform, msgs, idents, renderer, types,
+  commands, magicsys, modulegraphs, lineinfos, wordrecg
 
+import std/[strutils, math, strtabs]
 from system/memory import nimCStrLen
 
 when defined(nimPreviewSlimSystem):
diff --git a/compiler/semobjconstr.nim b/compiler/semobjconstr.nim
index ebc8be0c3..33278af2f 100644
--- a/compiler/semobjconstr.nim
+++ b/compiler/semobjconstr.nim
@@ -11,7 +11,7 @@
 
 # included from sem.nim
 
-from sugar import dup
+from std/sugar import dup
 
 type
   ObjConstrContext = object
diff --git a/compiler/semparallel.nim b/compiler/semparallel.nim
index 41ec3e480..af77a1972 100644
--- a/compiler/semparallel.nim
+++ b/compiler/semparallel.nim
@@ -26,7 +26,7 @@ import
   renderer, types, modulegraphs, options, spawn, lineinfos
 
 from trees import getMagic, getRoot
-from strutils import `%`
+from std/strutils import `%`
 
 discard """
 
diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim
index 423cfbb34..54f46fa73 100644
--- a/compiler/sempass2.nim
+++ b/compiler/sempass2.nim
@@ -8,11 +8,13 @@
 #
 
 import
-  intsets, ast, astalgo, msgs, renderer, magicsys, types, idents, trees,
-  wordrecg, strutils, options, guards, lineinfos, semfold, semdata,
-  modulegraphs, varpartitions, typeallowed, nilcheck, errorhandling, tables,
+  ast, astalgo, msgs, renderer, magicsys, types, idents, trees,
+  wordrecg, options, guards, lineinfos, semfold, semdata,
+  modulegraphs, varpartitions, typeallowed, nilcheck, errorhandling,
   semstrictfuncs
 
+import std/[tables, intsets, strutils]
+
 when defined(nimPreviewSlimSystem):
   import std/assertions
 
diff --git a/compiler/sighashes.nim b/compiler/sighashes.nim
index dbf16df3d..2f1a72fd6 100644
--- a/compiler/sighashes.nim
+++ b/compiler/sighashes.nim
@@ -9,8 +9,9 @@
 
 ## Computes hash values for routine (proc, method etc) signatures.
 
-import ast, tables, ropes, modulegraphs, options, msgs, pathutils
-from hashes import Hash
+import ast, ropes, modulegraphs, options, msgs, pathutils
+from std/hashes import Hash
+import std/tables
 import types
 import ../dist/checksums/src/checksums/md5
 
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim
index 3867a67b7..77f8de68b 100644
--- a/compiler/sigmatch.nim
+++ b/compiler/sigmatch.nim
@@ -11,10 +11,12 @@
 ## the call to overloaded procs, generic procs and operators.
 
 import
-  intsets, ast, astalgo, semdata, types, msgs, renderer, lookups, semtypinst,
-  magicsys, idents, lexer, options, parampatterns, strutils, trees,
+  ast, astalgo, semdata, types, msgs, renderer, lookups, semtypinst,
+  magicsys, idents, lexer, options, parampatterns, trees,
   linter, lineinfos, lowerings, modulegraphs, concepts
 
+import std/[intsets, strutils]
+
 when defined(nimPreviewSlimSystem):
   import std/assertions
 
diff --git a/compiler/suggest.nim b/compiler/suggest.nim
index 5554991bd..5714c6d21 100644
--- a/compiler/suggest.nim
+++ b/compiler/suggest.nim
@@ -32,11 +32,13 @@
 
 # included from sigmatch.nim
 
-import algorithm, sets, prefixmatches, parseutils, tables
+import prefixmatches
 from wordrecg import wDeprecated, wError, wAddr, wYield
 
+import std/[algorithm, sets, parseutils, tables]
+
 when defined(nimsuggest):
-  import tables, pathutils # importer
+  import std/tables, pathutils # importer
 
 const
   sep = '\t'
diff --git a/compiler/syntaxes.nim b/compiler/syntaxes.nim
index 1c8acf2a6..ef6b1da58 100644
--- a/compiler/syntaxes.nim
+++ b/compiler/syntaxes.nim
@@ -10,9 +10,10 @@
 ## Implements the dispatcher for the different parsers.
 
 import
-  strutils, llstream, ast, idents, lexer, options, msgs, parser,
+  llstream, ast, idents, lexer, options, msgs, parser,
   filters, filter_tmpl, renderer, lineinfos, pathutils
 
+import std/strutils
 when defined(nimPreviewSlimSystem):
   import std/[syncio, assertions]
 
diff --git a/compiler/treetab.nim b/compiler/treetab.nim
index 92e04c13a..6685c4a89 100644
--- a/compiler/treetab.nim
+++ b/compiler/treetab.nim
@@ -9,8 +9,9 @@
 
 # Implements a table from trees to trees. Does structural equivalence checking.
 
-import
-  hashes, ast, astalgo, types
+import ast, astalgo, types
+
+import std/hashes
 
 when defined(nimPreviewSlimSystem):
   import std/assertions
diff --git a/compiler/typeallowed.nim b/compiler/typeallowed.nim
index fe0d7b885..d0df66f18 100644
--- a/compiler/typeallowed.nim
+++ b/compiler/typeallowed.nim
@@ -10,8 +10,8 @@
 ## This module contains 'typeAllowed' and friends which check
 ## for invalid types like `openArray[var int]`.
 
-import
-  intsets, ast, renderer, options, semdata, types
+import ast, renderer, options, semdata, types
+import std/intsets
 
 when defined(nimPreviewSlimSystem):
   import std/assertions
diff --git a/compiler/types.nim b/compiler/types.nim
index cdb3067c3..31563b71f 100644
--- a/compiler/types.nim
+++ b/compiler/types.nim
@@ -10,9 +10,11 @@
 # this module contains routines for accessing and iterating over types
 
 import
-  intsets, ast, astalgo, trees, msgs, strutils, platform, renderer, options,
+  ast, astalgo, trees, msgs, platform, renderer, options,
   lineinfos, int128, modulegraphs, astmsgs
 
+import std/[intsets, strutils]
+
 when defined(nimPreviewSlimSystem):
   import std/[assertions, formatfloat]
 
diff --git a/compiler/typesrenderer.nim b/compiler/typesrenderer.nim
index ff8ec8d57..72bcddb05 100644
--- a/compiler/typesrenderer.nim
+++ b/compiler/typesrenderer.nim
@@ -7,7 +7,8 @@
 #    distribution, for details about the copyright.
 #
 
-import renderer, strutils, ast, types
+import renderer, ast, types
+import std/strutils
 
 when defined(nimPreviewSlimSystem):
   import std/assertions
diff --git a/compiler/vmdeps.nim b/compiler/vmdeps.nim
index a47d034c7..18f9fe5ca 100644
--- a/compiler/vmdeps.nim
+++ b/compiler/vmdeps.nim
@@ -7,9 +7,11 @@
 #    distribution, for details about the copyright.
 #
 
-import ast, types, msgs, os, options, idents, lineinfos
+import ast, types, msgs, options, idents, lineinfos
 from pathutils import AbsoluteFile
 
+import std/os
+
 when defined(nimPreviewSlimSystem):
   import std/syncio
 
diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim
index efcd0ec35..53b2974ba 100644
--- a/compiler/vmgen.nim
+++ b/compiler/vmgen.nim
@@ -26,14 +26,14 @@
 # solves the opcLdConst vs opcAsgnConst issue. Of course whether we need
 # this copy depends on the involved types.
 
-import tables
+import std/[tables, intsets, strutils]
 
 when defined(nimPreviewSlimSystem):
   import std/assertions
 
 import
-  strutils, ast, types, msgs, renderer, vmdef, trees,
-  intsets, magicsys, options, lowerings, lineinfos, transf, astmsgs
+  ast, types, msgs, renderer, vmdef, trees,
+  magicsys, options, lowerings, lineinfos, transf, astmsgs
 
 from modulegraphs import getBody
 
diff --git a/compiler/vmmarshal.nim b/compiler/vmmarshal.nim
index e1e69f6cc..8ce113369 100644
--- a/compiler/vmmarshal.nim
+++ b/compiler/vmmarshal.nim
@@ -9,9 +9,11 @@
 
 ## Implements marshaling for the VM.
 
-import streams, json, intsets, tables, ast, astalgo, idents, types, msgs,
+import ast, astalgo, idents, types, msgs,
   options, lineinfos
 
+import std/[streams, json, intsets, tables]
+
 when defined(nimPreviewSlimSystem):
   import std/[assertions, formatfloat]
 
diff --git a/compiler/vmprofiler.nim b/compiler/vmprofiler.nim
index edbd71813..3f0db84bd 100644
--- a/compiler/vmprofiler.nim
+++ b/compiler/vmprofiler.nim
@@ -1,7 +1,7 @@
 
-import
-  options, vmdef, times, lineinfos, strutils, tables,
-  msgs
+import options, vmdef, lineinfos, msgs
+
+import std/[times, strutils, tables]
 
 proc enter*(prof: var Profiler, c: PCtx, tos: PStackFrame) {.inline.} =
   if optProfileVM in c.config.globalOptions:
diff --git a/compiler/wordrecg.nim b/compiler/wordrecg.nim
index aa25f7fd1..55a8921af 100644
--- a/compiler/wordrecg.nim
+++ b/compiler/wordrecg.nim
@@ -145,6 +145,6 @@ const
 
 
 from std/enumutils import genEnumCaseStmt
-from strutils import normalize
+from std/strutils import normalize
 proc findStr*[T: enum](a, b: static[T], s: string, default: T): T =
   genEnumCaseStmt(T, s, default, ord(a), ord(b), normalize)