Skip to content

Commit

Permalink
Rollup merge of rust-lang#56322 - petrochenkov:edlints, r=eddyb
Browse files Browse the repository at this point in the history
resolve: Fix false-positives from lint `absolute_paths_not_starting_with_crate`

Fixes rust-lang#56311 (stable-to-beta regression)
  • Loading branch information
GuillaumeGomez authored Nov 29, 2018
2 parents f20a1d7 + d77edb6 commit 1fe2085
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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 1fe2085

Please sign in to comment.