From: bors Date: Sat, 15 Sep 2018 19:50:26 +0000 (+0000) Subject: Auto merge of #54116 - eddyb:extern-prelude, r=petrochenkov X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=e4ba1d41e3c2a66215943e43de70f93bb195b1f0;p=rust.git Auto merge of #54116 - eddyb:extern-prelude, r=petrochenkov rustc_resolve: allow only core, std, meta and --extern in Rust 2018 paths. As per https://github.com/rust-lang/rust/issues/53166#issuecomment-419265401: * 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 https://github.com/rust-lang/rust/issues/53166#issuecomment-421137230 * 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 --- e4ba1d41e3c2a66215943e43de70f93bb195b1f0