1
Fork 0

Don't lose an obligation cause

This commit is contained in:
Oli Scherer 2022-05-10 08:50:32 +00:00
parent 312d27d0a2
commit 7e2e3d4ebe
4 changed files with 24 additions and 7 deletions

View file

@ -309,8 +309,6 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
} }
.into() .into()
}); });
} else {
cause = traits::ObligationCause::misc(self.span, self.body_id);
} }
extend_cause_with_original_assoc_item_obligation( extend_cause_with_original_assoc_item_obligation(
tcx, trait_ref, item, &mut cause, predicate, tcx, trait_ref, item, &mut cause, predicate,

View file

@ -2,10 +2,18 @@ error[E0271]: type mismatch resolving `<T as Deref>::Target == T`
--> $DIR/hr-associated-type-projection-1.rs:13:33 --> $DIR/hr-associated-type-projection-1.rs:13:33
| |
LL | impl<T: Copy + std::ops::Deref> UnsafeCopy<'_, T> for T { LL | impl<T: Copy + std::ops::Deref> UnsafeCopy<'_, T> for T {
| - this type parameter ^^^^^^^^^^^^^^^^^ expected associated type, found type parameter `T` | - this type parameter ^^^^^^^^^^^^^^^^^ expected type parameter `T`, found associated type
| |
= note: expected associated type `<T as Deref>::Target` = note: expected type parameter `T`
found type parameter `T` found associated type `<T as Deref>::Target`
note: required by a bound in `UnsafeCopy`
--> $DIR/hr-associated-type-projection-1.rs:3:64
|
LL | trait UnsafeCopy<'a, T: Copy>
| ---------- required by a bound in this
LL | where
LL | for<'b> <Self as UnsafeCopy<'b, T>>::Item: std::ops::Deref<Target = T>,
| ^^^^^^^^^^ required by this bound in `UnsafeCopy`
help: consider further restricting this bound help: consider further restricting this bound
| |
LL | impl<T: Copy + std::ops::Deref + Deref<Target = T>> UnsafeCopy<'_, T> for T { LL | impl<T: Copy + std::ops::Deref + Deref<Target = T>> UnsafeCopy<'_, T> for T {

View file

@ -2,8 +2,13 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/builtin-superkinds-self-type.rs:10:16 --> $DIR/builtin-superkinds-self-type.rs:10:16
| |
LL | impl <T: Sync> Foo for T { } LL | impl <T: Sync> Foo for T { }
| ^^^ ...so that the type `T` will meet its required lifetime bounds | ^^^ ...so that the type `T` will meet its required lifetime bounds...
| |
note: ...that is required by this bound
--> $DIR/builtin-superkinds-self-type.rs:6:24
|
LL | trait Foo : Sized+Sync+'static {
| ^^^^^^^
help: consider adding an explicit lifetime bound... help: consider adding an explicit lifetime bound...
| |
LL | impl <T: Sync + 'static> Foo for T { } LL | impl <T: Sync + 'static> Foo for T { }

View file

@ -2,7 +2,13 @@ error[E0271]: type mismatch resolving `<std::vec::IntoIter<i32> as Iterator>::It
--> $DIR/assoc-type-in-superbad.rs:12:16 --> $DIR/assoc-type-in-superbad.rs:12:16
| |
LL | type Key = u32; LL | type Key = u32;
| ^^^ expected `i32`, found `u32` | ^^^ expected `u32`, found `i32`
|
note: required by a bound in `Foo`
--> $DIR/assoc-type-in-superbad.rs:7:25
|
LL | pub trait Foo: Iterator<Item=<Self as Foo>::Key> {
| ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Foo`
error: aborting due to previous error error: aborting due to previous error