summaryrefslogtreecommitdiffstats
path: root/tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr
blob: 6db72b8863258fbf77b32a9ef4e72ba8275bfcdb (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<Region(BrAnon(0, None)), Region(BrAnon(1, None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) i32)) -> &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) 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