Rollup merge of #56322 - petrochenkov:edlints, r=eddyb

resolve: Fix false-positives from lint `absolute_paths_not_starting_with_crate`

Fixes https://github.com/rust-lang/rust/issues/56311 (stable-to-beta regression)
This commit is contained in:
Guillaume Gomez 2018-11-29 13:10:53 +01:00 committed by GitHub
commit 1fe2085441
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 1 deletions

View File

@ -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,
};

View File

@ -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();
}
}
}

View File

@ -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() {}