When using existing fn as module, don't claim it doesn't exist
Tweak wording of module not found in resolve, when the name exists but belongs to a non-`mod` item. Fix #81232.
This commit is contained in:
parent
6d069a0ac7
commit
890ce26213
3 changed files with 16 additions and 4 deletions
|
@ -2028,7 +2028,19 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||
},
|
||||
)
|
||||
});
|
||||
(format!("use of undeclared crate or module `{ident}`"), suggestion)
|
||||
if let Ok(binding) = self.early_resolve_ident_in_lexical_scope(
|
||||
ident,
|
||||
ScopeSet::All(ValueNS),
|
||||
parent_scope,
|
||||
None,
|
||||
false,
|
||||
ignore_binding,
|
||||
) {
|
||||
let descr = binding.res().descr();
|
||||
(format!("{descr} `{ident}` is not a crate or module"), suggestion)
|
||||
} else {
|
||||
(format!("use of undeclared crate or module `{ident}`"), suggestion)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue