Skip to content

Commit ba9d7de

Browse files
petrochenkovalexcrichton
authored andcommitted
resolve: Fix false-positives from lint absolute_paths_not_starting_with_crate
1 parent 035198b commit ba9d7de

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
@@ -3952,7 +3952,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
39523952

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

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)