diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2022-04-23 16:41:36 -0700 |
|---|---|---|
| committer | Esteban Kuber <esteban@kuber.com.ar> | 2022-05-03 02:00:38 +0000 |
| commit | 57967269e9946945dedd360e8e8654f5dd76ebd1 (patch) | |
| tree | 19a8e48a54cf5ac759a9354027ae8b94e876bf7d /compiler/rustc_resolve/src/lib.rs | |
| parent | 3d0ac7ea23888438752957eeeb5aa2b73b4fda72 (diff) | |
| download | rust-57967269e9946945dedd360e8e8654f5dd76ebd1.tar.gz rust-57967269e9946945dedd360e8e8654f5dd76ebd1.zip | |
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
Diffstat (limited to 'compiler/rustc_resolve/src/lib.rs')
| -rw-r--r-- | compiler/rustc_resolve/src/lib.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index f6109b1dc1a..ff11aba49d8 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -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)] |
