diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index cbf82a8026667..c1d4643c2403e 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -3950,7 +3950,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { let first_name = match path.get(0) { // In the 2018 edition this lint is a hard error, so nothing to do - Some(seg) if seg.ident.span.rust_2015() => seg.ident.name, + Some(seg) if seg.ident.span.rust_2015() && self.session.rust_2015() => seg.ident.name, _ => return, }; diff --git a/src/test/ui/rust-2018/auxiliary/edition-lint-paths.rs b/src/test/ui/rust-2018/auxiliary/edition-lint-paths.rs index cc17a9bd6618b..dc4ab2131a834 100644 --- a/src/test/ui/rust-2018/auxiliary/edition-lint-paths.rs +++ b/src/test/ui/rust-2018/auxiliary/edition-lint-paths.rs @@ -9,3 +9,14 @@ // except according to those terms. pub fn foo() {} + +#[macro_export] +macro_rules! macro_2015 { + () => { + use edition_lint_paths as other_name; + use edition_lint_paths::foo as other_foo; + fn check_macro_2015() { + ::edition_lint_paths::foo(); + } + } +} diff --git a/src/test/ui/rust-2018/edition-lint-paths-2018.rs b/src/test/ui/rust-2018/edition-lint-paths-2018.rs new file mode 100644 index 0000000000000..09b31beb77585 --- /dev/null +++ b/src/test/ui/rust-2018/edition-lint-paths-2018.rs @@ -0,0 +1,10 @@ +// compile-pass +// edition:2018 +// compile-flags:--extern edition_lint_paths +// aux-build:edition-lint-paths.rs + +#![deny(absolute_paths_not_starting_with_crate)] + +edition_lint_paths::macro_2015!(); // OK + +fn main() {}