|
1 |
| -error: lifetime may not live long enough |
2 |
| - --> $DIR/expect-fn-supply-fn.rs:16:49 |
3 |
| - | |
4 |
| -LL | fn expect_free_supply_free_from_fn<'x>(x: &'x u32) { |
5 |
| - | -- lifetime `'x` defined here |
6 |
| -... |
7 |
| -LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {}); |
8 |
| - | ^ |
9 |
| - | | |
10 |
| - | has type `fn(&'1 u32)` |
11 |
| - | requires that `'1` must outlive `'x` |
12 |
| - |
13 |
| -error: lifetime may not live long enough |
14 |
| - --> $DIR/expect-fn-supply-fn.rs:16:49 |
15 |
| - | |
16 |
| -LL | fn expect_free_supply_free_from_fn<'x>(x: &'x u32) { |
17 |
| - | -- lifetime `'x` defined here |
18 |
| -... |
19 |
| -LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {}); |
20 |
| - | ^ requires that `'x` must outlive `'static` |
21 |
| - |
22 |
| -error[E0308]: mismatched types |
23 |
| - --> $DIR/expect-fn-supply-fn.rs:32:49 |
| 1 | +error[E0631]: type mismatch in closure arguments |
| 2 | + --> $DIR/expect-fn-supply-fn.rs:30:5 |
24 | 3 | |
|
25 | 4 | LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {});
|
26 |
| - | ^ one type is more general than the other |
| 5 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ---------------- found signature defined here |
| 6 | + | | |
| 7 | + | expected due to this |
| 8 | + | |
| 9 | + = note: expected closure signature `for<'a, 'b> fn(for<'a> fn(&'a u32), &'b i32) -> _` |
| 10 | + found closure signature `fn(for<'a> fn(&'a u32), _) -> _` |
| 11 | +note: required by a bound in `with_closure_expecting_fn_with_free_region` |
| 12 | + --> $DIR/expect-fn-supply-fn.rs:3:8 |
| 13 | + | |
| 14 | +LL | fn with_closure_expecting_fn_with_free_region<F>(_: F) |
| 15 | + | ------------------------------------------ required by a bound in this function |
| 16 | +LL | where |
| 17 | +LL | F: for<'a> FnOnce(fn(&'a u32), &i32), |
| 18 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `with_closure_expecting_fn_with_free_region` |
| 19 | +help: consider adjusting the signature so it borrows its argument |
27 | 20 | |
|
28 |
| - = note: expected fn pointer `fn(&u32)` |
29 |
| - found fn pointer `for<'a> fn(&'a u32)` |
| 21 | +LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), &y| {}); |
| 22 | + | + |
30 | 23 |
|
31 |
| -error[E0308]: mismatched types |
32 |
| - --> $DIR/expect-fn-supply-fn.rs:39:50 |
| 24 | +error[E0631]: type mismatch in closure arguments |
| 25 | + --> $DIR/expect-fn-supply-fn.rs:37:5 |
33 | 26 | |
|
34 | 27 | LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {});
|
35 |
| - | ^ one type is more general than the other |
| 28 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------------------- found signature defined here |
| 29 | + | | |
| 30 | + | expected due to this |
36 | 31 | |
|
37 |
| - = note: expected fn pointer `for<'a> fn(&'a u32)` |
38 |
| - found fn pointer `fn(&u32)` |
| 32 | + = note: expected closure signature `for<'a> fn(for<'a> fn(&'a u32), &'a i32) -> _` |
| 33 | + found closure signature `fn(fn(&'x u32), _) -> _` |
| 34 | +note: required by a bound in `with_closure_expecting_fn_with_bound_region` |
| 35 | + --> $DIR/expect-fn-supply-fn.rs:9:8 |
| 36 | + | |
| 37 | +LL | fn with_closure_expecting_fn_with_bound_region<F>(_: F) |
| 38 | + | ------------------------------------------- required by a bound in this function |
| 39 | +LL | where |
| 40 | +LL | F: FnOnce(fn(&u32), &i32), |
| 41 | + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `with_closure_expecting_fn_with_bound_region` |
| 42 | +help: consider adjusting the signature so it borrows its argument |
| 43 | + | |
| 44 | +LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), &y| {}); |
| 45 | + | + |
39 | 46 |
|
40 |
| -error[E0308]: mismatched types |
41 |
| - --> $DIR/expect-fn-supply-fn.rs:48:50 |
| 47 | +error[E0631]: type mismatch in closure arguments |
| 48 | + --> $DIR/expect-fn-supply-fn.rs:46:5 |
42 | 49 | |
|
43 | 50 | LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| {
|
44 |
| - | ^ one type is more general than the other |
| 51 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --------------- found signature defined here |
| 52 | + | | |
| 53 | + | expected due to this |
| 54 | + | |
| 55 | + = note: expected closure signature `for<'a> fn(for<'a> fn(&'a u32), &'a i32) -> _` |
| 56 | + found closure signature `for<'a> fn(for<'a> fn(&'a u32), _) -> _` |
| 57 | +note: required by a bound in `with_closure_expecting_fn_with_bound_region` |
| 58 | + --> $DIR/expect-fn-supply-fn.rs:9:8 |
| 59 | + | |
| 60 | +LL | fn with_closure_expecting_fn_with_bound_region<F>(_: F) |
| 61 | + | ------------------------------------------- required by a bound in this function |
| 62 | +LL | where |
| 63 | +LL | F: FnOnce(fn(&u32), &i32), |
| 64 | + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `with_closure_expecting_fn_with_bound_region` |
| 65 | +help: consider adjusting the signature so it borrows its argument |
45 | 66 | |
|
46 |
| - = note: expected fn pointer `for<'a> fn(&'a u32)` |
47 |
| - found fn pointer `fn(&u32)` |
| 67 | +LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, &y| { |
| 68 | + | + |
48 | 69 |
|
49 |
| -error: aborting due to 5 previous errors |
| 70 | +error: aborting due to 3 previous errors |
50 | 71 |
|
51 |
| -For more information about this error, try `rustc --explain E0308`. |
| 72 | +For more information about this error, try `rustc --explain E0631`. |
0 commit comments