Report "nice" placeholder errors more often
If we have a cause containing `ValuePairs::PolyTraitRefs` but neither TraitRef has any escaping bound regions then we report the same error as for `ValuePairs::TraitRefs`.
This commit is contained in:
parent
daab6db1a0
commit
94c11dfe78
19 changed files with 181 additions and 263 deletions
|
|
@ -1,5 +1,5 @@
|
|||
error: higher-ranked subtype error
|
||||
--> $DIR/issue-57843.rs:23:9
|
||||
--> $DIR/issue-57843.rs:25:9
|
||||
|
|
||||
LL | Foo(Box::new(|_| ()));
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -11,7 +11,9 @@ trait ClonableFn<T> {
|
|||
}
|
||||
|
||||
impl<T, F: 'static> ClonableFn<T> for F
|
||||
where F: Fn(T) + Clone {
|
||||
where
|
||||
F: Fn(T) + Clone,
|
||||
{
|
||||
fn clone(&self) -> Box<dyn Fn(T)> {
|
||||
Box::new(self.clone())
|
||||
}
|
||||
|
|
@ -20,5 +22,5 @@ where F: Fn(T) + Clone {
|
|||
struct Foo(Box<dyn for<'a> ClonableFn<&'a bool>>);
|
||||
|
||||
fn main() {
|
||||
Foo(Box::new(|_| ())); //~ ERROR mismatched types
|
||||
Foo(Box::new(|_| ())); //~ ERROR implementation of `FnOnce` is not general enough
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,11 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-57843.rs:23:9
|
||||
error: implementation of `FnOnce` is not general enough
|
||||
--> $DIR/issue-57843.rs:25:9
|
||||
|
|
||||
LL | Foo(Box::new(|_| ()));
|
||||
| ^^^^^^^^^^^^^^^^ one type is more general than the other
|
||||
| ^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
|
||||
|
|
||||
= note: expected type `FnOnce<(&'a bool,)>`
|
||||
found type `FnOnce<(&bool,)>`
|
||||
note: this closure does not fulfill the lifetime requirements
|
||||
--> $DIR/issue-57843.rs:23:18
|
||||
|
|
||||
LL | Foo(Box::new(|_| ()));
|
||||
| ^^^^^^
|
||||
= note: `[closure@$DIR/issue-57843.rs:25:18: 25:24]` must implement `FnOnce<(&'1 bool,)>`, for any lifetime `'1`...
|
||||
= note: ...but it actually implements `FnOnce<(&'2 bool,)>`, for some specific lifetime `'2`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue