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