about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc_resolve/macros.rs13
-rw-r--r--src/test/ui/editions/edition-imports-virtual-2015-gated.stderr2
2 files changed, 10 insertions, 5 deletions
diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs
index 7856661741d..b2b794c6925 100644
--- a/src/librustc_resolve/macros.rs
+++ b/src/librustc_resolve/macros.rs
@@ -828,7 +828,7 @@ impl<'a> Resolver<'a> {
             // but its `Def` should coincide with a crate passed with `--extern`
             // (otherwise there would be ambiguity) and we can skip feature error in this case.
             'ok: {
-                if !is_import || self.session.features_untracked().uniform_paths {
+                if !is_import || (!rust_2015 && self.session.features_untracked().uniform_paths) {
                     break 'ok;
                 }
                 if ns == TypeNS && use_prelude && self.extern_prelude_get(ident, true).is_some() {
@@ -844,10 +844,15 @@ impl<'a> Resolver<'a> {
                     }
                 }
 
-                let msg = "imports can only refer to extern crate names \
-                           passed with `--extern` on stable channel";
+                let reason = if rust_2015 {
+                    "in macros originating from 2015 edition"
+                } else {
+                    "on stable channel"
+                };
+                let msg = format!("imports can only refer to extern crate names \
+                                   passed with `--extern` {}", reason);
                 let mut err = feature_err(&self.session.parse_sess, "uniform_paths",
-                                          ident.span, GateIssue::Language, msg);
+                                          ident.span, GateIssue::Language, &msg);
 
                 let what = self.binding_description(binding, ident,
                                                     flags.contains(Flags::MISC_FROM_PRELUDE));
diff --git a/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr b/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr
index 7c1837e3f56..3cf967dbf70 100644
--- a/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr
+++ b/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr
@@ -1,4 +1,4 @@
-error[E0658]: imports can only refer to extern crate names passed with `--extern` on stable channel (see issue #53130)
+error[E0658]: imports can only refer to extern crate names passed with `--extern` in macros originating from 2015 edition (see issue #53130)
   --> <::edition_imports_2015::gen_gated macros>:1:50
    |
 LL | (  ) => { fn check_gated (  ) { enum E { A } use E :: * ; } }