about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-10-18 04:11:03 +0900
committerGitHub <noreply@github.com>2020-10-18 04:11:03 +0900
commitd10b98d7a5c57369f102f7f15789014ceba8a6c8 (patch)
tree954170e9ebc5cd620e720bc587bd2c831c5e5a80
parent6af9846fcc8797bf97e9fb387385208c2219f3d0 (diff)
parent3522add318f8fbcd96a032f6779be09ba3d80478 (diff)
downloadrust-d10b98d7a5c57369f102f7f15789014ceba8a6c8.tar.gz
rust-d10b98d7a5c57369f102f7f15789014ceba8a6c8.zip
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
-rw-r--r--compiler/rustc_resolve/src/lib.rs3
-rw-r--r--src/test/ui/rfc-2126-extern-absolute-paths/meta.rs7
-rw-r--r--src/test/ui/rfc-2126-extern-absolute-paths/meta.stderr9
3 files changed, 0 insertions, 19 deletions
diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs
index 6677a5ffe28..e7486db4deb 100644
--- a/compiler/rustc_resolve/src/lib.rs
+++ b/compiler/rustc_resolve/src/lib.rs
@@ -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());
-                }
             }
         }
 
diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/meta.rs b/src/test/ui/rfc-2126-extern-absolute-paths/meta.rs
deleted file mode 100644
index 1fb5878ca2a..00000000000
--- a/src/test/ui/rfc-2126-extern-absolute-paths/meta.rs
+++ /dev/null
@@ -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() {}
diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/meta.stderr b/src/test/ui/rfc-2126-extern-absolute-paths/meta.stderr
deleted file mode 100644
index eb4b9dea41b..00000000000
--- a/src/test/ui/rfc-2126-extern-absolute-paths/meta.stderr
+++ /dev/null
@@ -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`.