Rollup merge of #108294 - compiler-errors:arbitary-sugg-binder, r=TaKO8Ki
Place binder correctly for arbitrary trait bound suggestion suggest `for<'a> &'a T: Trait` instead of `&'a T: for<'a> T`.
This commit is contained in:
commit
ac258e9e02
3 changed files with 40 additions and 2 deletions
|
@ -117,7 +117,7 @@ pub fn suggest_arbitrary_trait_bound<'tcx>(
|
|||
}
|
||||
|
||||
let param_name = trait_pred.skip_binder().self_ty().to_string();
|
||||
let mut constraint = trait_pred.print_modifiers_and_trait_path().to_string();
|
||||
let mut constraint = trait_pred.to_string();
|
||||
|
||||
if let Some((name, term)) = associated_ty {
|
||||
// FIXME: this case overlaps with code in TyCtxt::note_and_explain_type_err.
|
||||
|
@ -144,7 +144,7 @@ pub fn suggest_arbitrary_trait_bound<'tcx>(
|
|||
this requirement",
|
||||
if generics.where_clause_span.is_empty() { "introducing a" } else { "extending the" },
|
||||
),
|
||||
format!("{} {}: {}", generics.add_where_or_trailing_comma(), param_name, constraint),
|
||||
format!("{} {constraint}", generics.add_where_or_trailing_comma()),
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue