Rollup merge of #75802 - petrochenkov:nometa, r=nikomatsakis

resolve: Do not put nonexistent crate `meta` into prelude

Before the 2018 edition release there was some vague suggestion about adding a crate named `meta` to the standard distribution.
On this basis the name `meta` was "partially reserved" by putting `meta` into extern prelude (this means importing something named `meta` will result in an ambiguity error, for example).
This only caused confusion so far, and two years later there are no specific plans to add such crate.

If some standard crate (named `meta` or not) is added in the future, then cargo will hopefully already have ability to put it into extern prelude explicitly through `Cargo.toml`.
Otherwise, it could be added to extern prelude by the compiler at edition boundary.

Closes https://github.com/rust-lang/rust/issues/73948
This commit is contained in:
Yuki Okushi 2020-10-18 04:11:03 +09:00 committed by GitHub
commit d10b98d7a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 19 deletions

View File

@ -1240,9 +1240,6 @@ impl<'a> Resolver<'a> {
extern_prelude.insert(Ident::with_dummy_span(sym::core), Default::default());
if !session.contains_name(&krate.attrs, sym::no_std) {
extern_prelude.insert(Ident::with_dummy_span(sym::std), Default::default());
if session.rust_2018() {
extern_prelude.insert(Ident::with_dummy_span(sym::meta), Default::default());
}
}
}

View File

@ -1,7 +0,0 @@
// edition:2018
// Tests that `meta` is allowed, even if the crate doesn't exist
// yet (i.e., it causes a different error than `not-allowed.rs`).
use meta; //~ ERROR can't find crate for `meta`
fn main() {}

View File

@ -1,9 +0,0 @@
error[E0463]: can't find crate for `meta`
--> $DIR/meta.rs:5:5
|
LL | use meta;
| ^^^^ can't find crate
error: aborting due to previous error
For more information about this error, try `rustc --explain E0463`.