Uh oh!
There was an error while loading. Please reload this page.
rustc_resolve: allow only core, std, meta and --extern in Rust 2018 paths. - #54116
Conversation
petrochenkov
commented
Sep 11, 2018
@bors r+ I'm still unhappy about forever hardcoding |
bors
commented
Sep 11, 2018
📌 Commit 0bde629b8df4412b210fed0ef4b8b81592a35278 has been approved by |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
aturon
commented
Sep 11, 2018
LGTM |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
rustc_resolve: allow only core, std, meta and --extern in Rust 2018 paths. As per #53166 (comment): * Rust 2018 imports can no longer refer to crates not in "extern prelude" * `::foo` won't load a crate named `foo` unless `foo` is in the "extern prelude" * `extern crate foo;`, however, remains unchanged (can load arbitrary crates) * `--extern crate_name` is added (note the lack of `=path`) as an unstable option * adds `crate_name` to the "extern prelude" (see above) * crate is searched in sysroot & library paths, just like `extern crate crate_name`. * `Cargo` support will be added later * `core`, `std` and ~~`proc_macro`~~ `meta` are *always* available in the extern prelude * warning for interaction with `no_std` / `no_core` will be added later * **EDIT**: `proc_macro` was replaced by `meta`, see #53166 (comment) * note that there is no crate named `meta` being added, so `use meta::...;` will fail, we're only whitelisting it so we can start producing `uniform_paths` compatibility errors Fixes#54006 (as the example now requires `--extern alloc`, which is unstable). Fixes#54253 (hit during fixing RLS). r? @petrochenkov cc @aturon@alexcrichton@Centril@joshtriplett
bors
commented
Sep 15, 2018
☀️ Test successful - status-appveyor, status-travis |
rust-highfive
commented
Sep 15, 2018
Tested on commit rust-lang/rust@e4ba1d4. Direct link to PR: <rust-lang/rust#54116> 🎉 clippy-driver on windows: test-fail → test-pass. 🎉 clippy-driver on linux: test-fail → test-pass.
eddyb
commented
Sep 15, 2018
cc @rust-lang/release I believe this was the last blocker for RC. |
Nemo157
commented
Sep 18, 2018
This change (I assume) affects benchmarks as |
eddyb
commented
Sep 18, 2018
@Nemo157 |
Stabilize --extern flag without a path. This stabilizes the `--extern` flag without a path, implemented in rust-lang#54116. This flag is used to add a crate that may be found in the search path to the extern prelude. The intent of stabilizing this now is to change Cargo to emit this flag for `proc_macro` when building a proc-macro crate. This will allow the ability to elide `extern crate proc_macro;` for proc-macros, one of the few places where it is still necessary. It is intended that Cargo may also use this flag for other cases in the future as part of the [std-aware work](https://github.com/rust-lang/wg-cargo-std-aware/). There will likely be some kind of syntax where users may declare dependencies on other crates (such as `alloc`), and Cargo will use this flag so that they may be used like any other crate. At this time there are no short-term plans to use it for anything other than proc-macro. This will not help for non-proc-macro crates that use `proc_macro`, which I believe is not too common? An alternate approach for proc-macro is to use the `meta` crate, but from my inquiries there doesn't appear to be anyone interested in pushing that forward. The `meta` crate also doesn't help with things like `alloc` or `test`. cc rust-lang#57288
Stabilize --extern flag without a path. This stabilizes the `--extern` flag without a path, implemented in rust-lang#54116. This flag is used to add a crate that may be found in the search path to the extern prelude. The intent of stabilizing this now is to change Cargo to emit this flag for `proc_macro` when building a proc-macro crate. This will allow the ability to elide `extern crate proc_macro;` for proc-macros, one of the few places where it is still necessary. It is intended that Cargo may also use this flag for other cases in the future as part of the [std-aware work](https://github.com/rust-lang/wg-cargo-std-aware/). There will likely be some kind of syntax where users may declare dependencies on other crates (such as `alloc`), and Cargo will use this flag so that they may be used like any other crate. At this time there are no short-term plans to use it for anything other than proc-macro. This will not help for non-proc-macro crates that use `proc_macro`, which I believe is not too common? An alternate approach for proc-macro is to use the `meta` crate, but from my inquiries there doesn't appear to be anyone interested in pushing that forward. The `meta` crate also doesn't help with things like `alloc` or `test`. cc rust-lang#57288
Stabilize --extern flag without a path. This stabilizes the `--extern` flag without a path, implemented in #54116. This flag is used to add a crate that may be found in the search path to the extern prelude. The intent of stabilizing this now is to change Cargo to emit this flag for `proc_macro` when building a proc-macro crate. This will allow the ability to elide `extern crate proc_macro;` for proc-macros, one of the few places where it is still necessary. It is intended that Cargo may also use this flag for other cases in the future as part of the [std-aware work](https://github.com/rust-lang/wg-cargo-std-aware/). There will likely be some kind of syntax where users may declare dependencies on other crates (such as `alloc`), and Cargo will use this flag so that they may be used like any other crate. At this time there are no short-term plans to use it for anything other than proc-macro. This will not help for non-proc-macro crates that use `proc_macro`, which I believe is not too common? An alternate approach for proc-macro is to use the `meta` crate, but from my inquiries there doesn't appear to be anyone interested in pushing that forward. The `meta` crate also doesn't help with things like `alloc` or `test`. cc #57288
As per #53166 (comment):
::foowon't load a crate namedfoounlessfoois in the "extern prelude"extern crate foo;, however, remains unchanged (can load arbitrary crates)--extern crate_nameis added (note the lack of=path) as an unstable optioncrate_nameto the "extern prelude" (see above)extern crate crate_name.Cargosupport will be added latercore,stdandproc_macrometaare always available in the extern preludeno_std/no_corewill be added laterproc_macrowas replaced bymeta, see std-using paths work just fine in 2018 edition #![no_std] #53166 (comment)metabeing added, souse meta::...;will fail, we're only whitelisting it so we can start producinguniform_pathscompatibility errorsFixes#54006 (as the example now requires
--extern alloc, which is unstable).Fixes#54253 (hit during fixing RLS).
r? @petrochenkov cc @aturon@alexcrichton@Centril@joshtriplett