1
Fork 0

Rename HIR TypeBinding to AssocItemConstraint and related cleanup

This commit is contained in:
León Orell Valerian Liehr 2024-05-27 23:53:46 +02:00
parent 0a59f11362
commit 34c56c45cf
No known key found for this signature in database
GPG key ID: D17A07215F68E713
108 changed files with 878 additions and 818 deletions

View file

@ -450,7 +450,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
}
/// When after several dereferencing, the reference satisfies the trait
/// binding. This function provides dereference suggestion for this
/// bound. This function provides dereference suggestion for this
/// specific situation.
fn suggest_dereferences(
&self,
@ -777,7 +777,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
}
/// We tried to apply the bound to an `fn` or closure. Check whether calling it would
/// evaluate to a type that *would* satisfy the trait binding. If it would, suggest calling
/// evaluate to a type that *would* satisfy the trait bound. If it would, suggest calling
/// it: `bar(foo)` → `bar(foo())`. This case is *very* likely to be hit if `foo` is `async`.
fn suggest_fn_call(
&self,
@ -1241,7 +1241,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
let param_env = obligation.param_env;
// Try to apply the original trait binding obligation by borrowing.
// Try to apply the original trait bound by borrowing.
let mut try_borrowing = |old_pred: ty::PolyTraitPredicate<'tcx>,
blacklist: &[DefId]|
-> bool {
@ -4908,14 +4908,12 @@ pub fn suggest_desugaring_async_fn_to_impl_future_in_trait<'tcx>(
// `async fn` should always lower to a single bound... but don't ICE.
return None;
};
let Some(hir::PathSegment { args: Some(generics), .. }) =
trait_ref.trait_ref.path.segments.last()
let Some(hir::PathSegment { args: Some(args), .. }) = trait_ref.trait_ref.path.segments.last()
else {
// desugaring to a single path segment for `Future<...>`.
return None;
};
let Some(hir::TypeBindingKind::Equality { term: hir::Term::Ty(future_output_ty) }) =
generics.bindings.get(0).map(|binding| binding.kind)
let Some(future_output_ty) = args.constraints.first().and_then(|constraint| constraint.ty())
else {
// Also should never happen.
return None;