1
Fork 0

Bless tests after #100769

This commit is contained in:
Michael Goulet 2022-08-21 03:52:08 +00:00
parent 5212ac9dac
commit d577eb09e5
2 changed files with 99 additions and 96 deletions

View file

@ -903,7 +903,9 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
obligation.cause.code() obligation.cause.code()
{ {
&parent_code &parent_code
} else if let ObligationCauseCode::ItemObligation(_) = obligation.cause.code() { } else if let ObligationCauseCode::ItemObligation(_)
| ObligationCauseCode::ExprItemObligation(..) = obligation.cause.code()
{
obligation.cause.code() obligation.cause.code()
} else if let ExpnKind::Desugaring(DesugaringKind::ForLoop) = } else if let ExpnKind::Desugaring(DesugaringKind::ForLoop) =
span.ctxt().outer_expn_data().kind span.ctxt().outer_expn_data().kind
@ -929,8 +931,9 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
let param_env = obligation.param_env; let param_env = obligation.param_env;
// Try to apply the original trait binding obligation by borrowing. // Try to apply the original trait binding obligation by borrowing.
let mut try_borrowing = let mut try_borrowing = |old_pred: ty::PolyTraitPredicate<'tcx>,
|old_pred: ty::PolyTraitPredicate<'tcx>, blacklist: &[DefId]| -> bool { blacklist: &[DefId]|
-> bool {
if blacklist.contains(&old_pred.def_id()) { if blacklist.contains(&old_pred.def_id()) {
return false; return false;
} }
@ -957,7 +960,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
let mut_ref_self_ty_satisfies_pred = mk_result(trait_pred_and_mut_ref); let mut_ref_self_ty_satisfies_pred = mk_result(trait_pred_and_mut_ref);
let (ref_inner_ty_satisfies_pred, ref_inner_ty_mut) = let (ref_inner_ty_satisfies_pred, ref_inner_ty_mut) =
if let ObligationCauseCode::ItemObligation(_) = obligation.cause.code() if let ObligationCauseCode::ItemObligation(_) | ObligationCauseCode::ExprItemObligation(..) = obligation.cause.code()
&& let ty::Ref(_, ty, mutability) = old_pred.self_ty().skip_binder().kind() && let ty::Ref(_, ty, mutability) = old_pred.self_ty().skip_binder().kind()
{ {
( (

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `&mut usize: Default` is not satisfied
--> $DIR/suggest-adding-reference-to-trait-assoc-item.rs:13:9 --> $DIR/suggest-adding-reference-to-trait-assoc-item.rs:13:9
| |
LL | foo(Default::default()); LL | foo(Default::default());
| ^^^^^^^^^^^^^^^^ expected an implementor of trait `Default` | ^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `&mut usize`
| |
help: consider mutably borrowing here help: consider mutably borrowing here
| |
@ -13,7 +13,7 @@ error[E0277]: the trait bound `&usize: Default` is not satisfied
--> $DIR/suggest-adding-reference-to-trait-assoc-item.rs:14:9 --> $DIR/suggest-adding-reference-to-trait-assoc-item.rs:14:9
| |
LL | bar(Default::default()); LL | bar(Default::default());
| ^^^^^^^^^^^^^^^^ expected an implementor of trait `Default` | ^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `&usize`
| |
help: consider borrowing here help: consider borrowing here
| |