Skip to content

Commit 1fe2085

Browse files
Rollup merge of #56322 - petrochenkov:edlints, r=eddyb
resolve: Fix false-positives from lint `absolute_paths_not_starting_with_crate` Fixes #56311 (stable-to-beta regression)
2 parents f20a1d7 + d77edb6 commit 1fe2085

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

src/librustc_resolve/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3950,7 +3950,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
39503950

39513951
let first_name = match path.get(0) {
39523952
// In the 2018 edition this lint is a hard error, so nothing to do
3953-
Some(seg) if seg.ident.span.rust_2015() => seg.ident.name,
3953+
Some(seg) if seg.ident.span.rust_2015() && self.session.rust_2015() => seg.ident.name,
39543954
_ => return,
39553955
};
39563956

src/test/ui/rust-2018/auxiliary/edition-lint-paths.rs

+11
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,14 @@
99
// except according to those terms.
1010

1111
pub fn foo() {}
12+
13+
#[macro_export]
14+
macro_rules! macro_2015 {
15+
() => {
16+
use edition_lint_paths as other_name;
17+
use edition_lint_paths::foo as other_foo;
18+
fn check_macro_2015() {
19+
::edition_lint_paths::foo();
20+
}
21+
}
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// compile-pass
2+
// edition:2018
3+
// compile-flags:--extern edition_lint_paths
4+
// aux-build:edition-lint-paths.rs
5+
6+
#![deny(absolute_paths_not_starting_with_crate)]
7+
8+
edition_lint_paths::macro_2015!(); // OK
9+
10+
fn main() {}

0 commit comments

Comments
 (0)