show self
suggestion when items are in the block
This commit is contained in:
parent
41ee2e9124
commit
288e7caf19
@ -588,18 +588,16 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
|
||||
Success(module) => module,
|
||||
Indeterminate => return Indeterminate,
|
||||
Failed(err) => {
|
||||
let self_module = self.current_module.clone();
|
||||
let self_module = self.module_map[&self.current_module.normal_ancestor_id.unwrap()];
|
||||
|
||||
let resolve_from_self_result = self.resolve_module_path_from_root(
|
||||
&self_module, &module_path, 0, Some(span));
|
||||
|
||||
return match resolve_from_self_result {
|
||||
Success(_) => {
|
||||
let msg = format!("Did you mean `self::{}`?",
|
||||
&names_to_string(module_path));
|
||||
Failed(Some((span, msg)))
|
||||
},
|
||||
_ => Failed(err),
|
||||
return if let Success(_) = resolve_from_self_result {
|
||||
let msg = format!("Did you mean `self::{}`?", &names_to_string(module_path));
|
||||
Failed(Some((span, msg)))
|
||||
} else {
|
||||
Failed(err)
|
||||
};
|
||||
},
|
||||
};
|
||||
|
@ -44,3 +44,14 @@ mod m {
|
||||
use MyEnum::*; //~ ERROR unresolved import `MyEnum::*` [E0432]
|
||||
//~^ Did you mean `self::MyEnum`?
|
||||
}
|
||||
|
||||
mod items {
|
||||
enum Enum {
|
||||
Variant
|
||||
}
|
||||
|
||||
use Enum::*; //~ ERROR unresolved import `Enum::*` [E0432]
|
||||
//~^ Did you mean `self::Enum`?
|
||||
|
||||
fn item() {}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user