mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-19 18:34:08 +00:00
resolve: Don't add unnecessary import candidates for prefix::{self}
imports
This commit is contained in:
parent
a3085756ed
commit
5fd7d2fc76
@ -312,8 +312,8 @@ impl<'a> Resolver<'a> {
|
||||
|
||||
self.indeterminate_imports.push(directive);
|
||||
match directive.subclass {
|
||||
SingleImport { target, .. } => {
|
||||
self.per_ns(|this, ns| {
|
||||
SingleImport { target, type_ns_only, .. } => {
|
||||
self.per_ns(|this, ns| if !type_ns_only || ns == TypeNS {
|
||||
let mut resolution = this.resolution(current_module, target, ns).borrow_mut();
|
||||
resolution.single_imports.add_directive(directive, this.use_extern_macros);
|
||||
});
|
||||
|
16
src/test/run-pass/auxiliary/use-macro-self.rs
Normal file
16
src/test/run-pass/auxiliary/use-macro-self.rs
Normal file
@ -0,0 +1,16 @@
|
||||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
pub mod foobarius {}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! foobarius {
|
||||
() => { () }
|
||||
}
|
22
src/test/run-pass/use-macro-self.rs
Normal file
22
src/test/run-pass/use-macro-self.rs
Normal file
@ -0,0 +1,22 @@
|
||||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// aux-build:use-macro-self.rs
|
||||
|
||||
#![feature(use_extern_macros)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate use_macro_self;
|
||||
|
||||
use use_macro_self::foobarius::{self};
|
||||
|
||||
fn main() {
|
||||
let _: () = foobarius!(); // OK, the macro returns `()`
|
||||
}
|
Loading…
Reference in New Issue
Block a user