diff options
| author | Santiago Pastorino <spastorino@gmail.com> | 2023-06-23 18:18:05 -0300 |
|---|---|---|
| committer | Santiago Pastorino <spastorino@gmail.com> | 2023-06-23 18:23:52 -0300 |
| commit | 6d997876c1f3a9fe5b06ea2b2f64e77eecc41adb (patch) | |
| tree | ebcef0403042b9d7a72e77c12c8330ae7c088628 /compiler | |
| parent | 54d6738a8df74382c439e1dfb9ce4e2382d7742e (diff) | |
| download | rust-6d997876c1f3a9fe5b06ea2b2f64e77eecc41adb.tar.gz rust-6d997876c1f3a9fe5b06ea2b2f64e77eecc41adb.zip | |
Fix associated type suggestion when -Zlower-impl-trait-in-trait-to-assoc-ty
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/astconv/errors.rs | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/compiler/rustc_hir_analysis/src/astconv/errors.rs b/compiler/rustc_hir_analysis/src/astconv/errors.rs index 7f060af2245..dc17ef7048d 100644 --- a/compiler/rustc_hir_analysis/src/astconv/errors.rs +++ b/compiler/rustc_hir_analysis/src/astconv/errors.rs @@ -122,9 +122,13 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { let all_candidate_names: Vec<_> = all_candidates() .flat_map(|r| self.tcx().associated_items(r.def_id()).in_definition_order()) - .filter_map( - |item| if item.kind == ty::AssocKind::Type { Some(item.name) } else { None }, - ) + .filter_map(|item| { + if item.opt_rpitit_info.is_none() && item.kind == ty::AssocKind::Type { + Some(item.name) + } else { + None + } + }) .collect(); if let (Some(suggested_name), true) = ( @@ -159,9 +163,13 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { .flat_map(|trait_def_id| { self.tcx().associated_items(*trait_def_id).in_definition_order() }) - .filter_map( - |item| if item.kind == ty::AssocKind::Type { Some(item.name) } else { None }, - ) + .filter_map(|item| { + if item.opt_rpitit_info.is_none() && item.kind == ty::AssocKind::Type { + Some(item.name) + } else { + None + } + }) .collect(); if let (Some(suggested_name), true) = ( |
