diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2023-06-21 20:00:50 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-21 20:00:50 +0200 |
| commit | 5ed75a96285ffc453039dfb6e1123cf598b8d560 (patch) | |
| tree | 030172406216598a3ccce946fc2406553e1d596e /compiler | |
| parent | a5561eb4d5027d1816c45251faed694c0453cc9f (diff) | |
| parent | 7563909a28a2add4e41cb653e4d7ebd50c97bce4 (diff) | |
| download | rust-5ed75a96285ffc453039dfb6e1123cf598b8d560.tar.gz rust-5ed75a96285ffc453039dfb6e1123cf598b8d560.zip | |
Rollup merge of #112868 - compiler-errors:liberate-afit-sugg, r=WaffleLapkin
Liberate bound vars properly when suggesting missing async-fn-in-trait Fixes #112848
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/check/mod.rs | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/mod.rs b/compiler/rustc_hir_analysis/src/check/mod.rs index 4247869ce76..1dfe053b215 100644 --- a/compiler/rustc_hir_analysis/src/check/mod.rs +++ b/compiler/rustc_hir_analysis/src/check/mod.rs @@ -470,19 +470,16 @@ fn suggestion_signature<'tcx>( ); match assoc.kind { - ty::AssocKind::Fn => { - // We skip the binder here because the binder would deanonymize all - // late-bound regions, and we don't want method signatures to show up - // `as for<'r> fn(&'r MyType)`. Pretty-printing handles late-bound - // regions just fine, showing `fn(&MyType)`. - fn_sig_suggestion( - tcx, - tcx.fn_sig(assoc.def_id).subst(tcx, substs).skip_binder(), - assoc.ident(tcx), - tcx.predicates_of(assoc.def_id).instantiate_own(tcx, substs), - assoc, - ) - } + ty::AssocKind::Fn => fn_sig_suggestion( + tcx, + tcx.liberate_late_bound_regions( + assoc.def_id, + tcx.fn_sig(assoc.def_id).subst(tcx, substs), + ), + assoc.ident(tcx), + tcx.predicates_of(assoc.def_id).instantiate_own(tcx, substs), + assoc, + ), ty::AssocKind::Type => { let (generics, where_clauses) = bounds_from_generic_predicates( tcx, |
