]> git.lizzy.rs Git - rust.git/blob - tests/ui/mismatched_types/closure-mismatch.stderr
Rollup merge of #106470 - ehuss:tidy-no-wasm, r=Mark-Simulacrum
[rust.git] / tests / ui / mismatched_types / closure-mismatch.stderr
1 error: implementation of `FnOnce` is not general enough
2   --> $DIR/closure-mismatch.rs:8:5
3    |
4 LL |     baz(|_| ());
5    |     ^^^^^^^^^^^ implementation of `FnOnce` is not general enough
6    |
7    = note: closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`...
8    = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2`
9
10 error[E0308]: mismatched types
11   --> $DIR/closure-mismatch.rs:8:5
12    |
13 LL |     baz(|_| ());
14    |     ^^^^^^^^^^^ one type is more general than the other
15    |
16    = note: expected trait `for<'a> Fn<(&'a (),)>`
17               found trait `Fn<(&(),)>`
18 note: this closure does not fulfill the lifetime requirements
19   --> $DIR/closure-mismatch.rs:8:9
20    |
21 LL |     baz(|_| ());
22    |         ^^^
23 note: the lifetime requirement is introduced here
24   --> $DIR/closure-mismatch.rs:5:11
25    |
26 LL | fn baz<T: Foo>(_: T) {}
27    |           ^^^
28
29 error: aborting due to 2 previous errors
30
31 For more information about this error, try `rustc --explain E0308`.