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:
parent
3d0ac7ea23
commit
57967269e9
14 changed files with 149 additions and 17 deletions
|
@ -696,6 +696,9 @@ struct UseError<'a> {
|
|||
instead: bool,
|
||||
/// Extra free-form suggestion.
|
||||
suggestion: Option<(Span, &'static str, String, Applicability)>,
|
||||
/// Path `Segment`s at the place of use that failed. Used for accurate suggestion after telling
|
||||
/// the user to import the item directly.
|
||||
path: Vec<Segment>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Debug)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue