Skip to content

Commit 3935863

Browse files
committed
no_std w/ std deps lint in future possiblities
1 parent fb12d50 commit 3935863

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

text/3875-build-std-explicit-dependencies.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,21 +1071,24 @@ of dependency on the standard library. It could therefore be desirable to
10711071
deprecate `#![no_std]` so that there remains only a single way to express a
10721072
dependency on the standard library.
10731073
1074-
10751074
`#![no_std]` serves two purposes - it stops the compiler from adding `std` to
10761075
the extern prelude and it prevents the user from depending on anything from
10771076
`std` accidentally. rustc's default behaviour of loading `std` when not
10781077
explicitly provided the crate via an `--extern` flag should be preserved for
10791078
backwards-compatibility with existing direct invocations of rustc.
10801079
1081-
`#![no_std]` could instead become a compiler flag which would indicate to the
1082-
compiler that `std` should not be loaded by default and that `core`'s prelude
1083-
should be used instead. Cargo would use this flag when driving rustc, providing
1084-
explicit paths to the newly-built or pre-built standard library crates, just as
1085-
with any other dependency.
1080+
Initially, if a crate has the `#![no_std]` attribute and has implicit
1081+
dependencies on the standard library in its `Cargo.toml`, a lint could be
1082+
emitted to suggest that their Cargo dependencies are adjusted.
1083+
1084+
Eventually, `#![no_std]` could instead become a compiler flag which would
1085+
indicate to the compiler that `std` should not be loaded by default and that
1086+
`core`'s prelude should be used instead. Cargo would use this flag when driving
1087+
rustc, providing explicit paths to the newly-built or pre-built standard library
1088+
crates, just as with any other dependency.
10861089
1087-
In addition, `#![no_std]` could be migrated to denying a lint which would
1088-
prevent use of items from `std`.
1090+
In addition, uses of the `#![no_std]` attribute could be migrated to denying a
1091+
lint which would prevent use of items from `std`.
10891092
10901093
↩ [*Proposal*][proposal]
10911094

0 commit comments

Comments
 (0)