File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ trait T < ' x > {
2
+ type V ;
3
+ }
4
+
5
+ impl < ' g > T < ' g > for u32 {
6
+ type V = u16 ;
7
+ }
8
+
9
+ fn main ( ) {
10
+ ( & |_|( ) ) as & dyn for < ' x > Fn ( <u32 as T < ' x > >:: V ) ;
11
+ //~^ ERROR: type mismatch in closure arguments
12
+ //~| ERROR: type mismatch resolving
13
+ }
Original file line number Diff line number Diff line change
1
+ error[E0631]: type mismatch in closure arguments
2
+ --> $DIR/issue-41366.rs:10:5
3
+ |
4
+ LL | (&|_|()) as &dyn for<'x> Fn(<u32 as T<'x>>::V);
5
+ | ^^-----^
6
+ | | |
7
+ | | found signature of `fn(_) -> _`
8
+ | expected signature of `for<'x> fn(<u32 as T<'x>>::V) -> _`
9
+ |
10
+ = note: required for the cast to the object type `dyn for<'x> std::ops::Fn(<u32 as T<'x>>::V)`
11
+
12
+ error[E0271]: type mismatch resolving `for<'x> <[closure@$DIR/issue-41366.rs:10:7: 10:12] as std::ops::FnOnce<(<u32 as T<'x>>::V,)>>::Output == ()`
13
+ --> $DIR/issue-41366.rs:10:5
14
+ |
15
+ LL | (&|_|()) as &dyn for<'x> Fn(<u32 as T<'x>>::V);
16
+ | ^^^^^^^^ expected bound lifetime parameter 'x, found concrete lifetime
17
+ |
18
+ = note: required for the cast to the object type `dyn for<'x> std::ops::Fn(<u32 as T<'x>>::V)`
19
+
20
+ error: aborting due to 2 previous errors
21
+
22
+ For more information about this error, try `rustc --explain E0271`.
You can’t perform that action at this time.
0 commit comments