Auto merge of #96353 - estebank:issue-95413, r=compiler-errors

When suggesting to import an item, also suggest changing the path if appropriate

When we don't find an item we search all of them for an appropriate
import and suggest `use`ing it. This is sometimes done for expressions
that have paths with more than one segment. We now also suggest changing
that path to work with the `use`.

Fix #95413
This commit is contained in:
bors
2022-05-04 01:58:23 +00:00
14 changed files with 132 additions and 1 deletions

View File

@@ -2693,6 +2693,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
def_id,
instead,
suggestion,
path: path.into(),
});
}
@@ -2756,6 +2757,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
def_id,
instead: false,
suggestion: None,
path: path.into(),
});
} else {
err.cancel();