Skip to content

Commit

Permalink
resolve: Fix false-positives from lint `absolute_paths_not_starting_w…
Browse files Browse the repository at this point in the history
…ith_crate`
  • Loading branch information
petrochenkov committed Nov 28, 2018
1 parent b68fc18 commit d77edb6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/librustc_resolve/lib.rs
Expand Up @@ -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,
};

Expand Down
11 changes: 11 additions & 0 deletions src/test/ui/rust-2018/auxiliary/edition-lint-paths.rs
Expand Up @@ -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();
}
}
}
10 changes: 10 additions & 0 deletions 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() {}

0 comments on commit d77edb6

Please sign in to comment.