summaryrefslogtreecommitdiffstats
path: root/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr
blob: 1c9d0c835494d4005ba9a454ccf16d17eb943ea4 (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
32
33
34
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<'r, 's> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed('r) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrNamed('s) }) i32)) -> &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed('r) }) 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() {
LL | |     expect_sig(|a, b| b); // ought to return `a`
LL | |
LL | | }
   | |_^
   |
   = note: defining type: test

error: aborting due to previous error