Add check to only output 'you might have meant' when the candidate name is in the same crate
This commit is contained in:
parent
be61f0237b
commit
0b936d2da7
1 changed files with 2 additions and 1 deletions
|
@ -691,7 +691,8 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
|
|||
let is_expected = &|res| source.is_expected(res);
|
||||
let ident_span = path.last().map_or(span, |ident| ident.ident.span);
|
||||
let typo_sugg = self.lookup_typo_candidate(path, source.namespace(), is_expected);
|
||||
if let TypoCandidate::Shadowed(res, Some(sugg_span)) = typo_sugg {
|
||||
let is_local = &|res: Res| res.opt_def_id().map_or(false, |id| id.is_local());
|
||||
if let TypoCandidate::Shadowed(res, Some(sugg_span)) = typo_sugg && is_local(res) {
|
||||
err.span_label(
|
||||
sugg_span,
|
||||
format!("you might have meant to refer to this {}", res.descr()),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue