blob: 68429142edecd2dd6bc1dfedbaa3f8631f7f21f2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
note: no external requirements
--> $DIR/return-wrong-bound-region.rs:11:16
|
LL | expect_sig(|a, b| b); // ought to return `a`
| ^^^^^^
|
= note: defining type: test::{closure#0} with closure substs [
i16,
for<'a, 'b> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed('a) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrNamed('b) }) i32)) -> &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed('a) }) i32,
(),
]
error: lifetime may not live long enough
--> $DIR/return-wrong-bound-region.rs:11:23
|
LL | expect_sig(|a, b| b); // ought to return `a`
| - - ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
| | |
| | has type `&'1 i32`
| has type `&'2 i32`
note: no external requirements
--> $DIR/return-wrong-bound-region.rs:10:1
|
LL | fn test() {
| ^^^^^^^^^
|
= note: defining type: test
error: aborting due to previous error
|