fork/rust
git clone https://git.julia.blue/fork/rust
f3e1a954d2e
1.41.1
1note: No external requirements 2 --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:21:15 3 | 4LL | foo(cell, |cell_a, cell_x| { 5 | _______________^ 6LL | | cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure 7LL | | 8LL | | }) 9 | |_____^ 10 | 11 = note: defining type: case1::{{closure}}#0 with closure substs [ 12 i32, 13 for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>)), 14 ] 15 16error[E0521]: borrowed data escapes outside of closure 17 --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:22:9 18 | 19LL | foo(cell, |cell_a, cell_x| { 20 | ------ ------ `cell_x` is a reference that is only valid in the closure body 21 | | 22 | `cell_a` is declared here, outside of the closure body 23LL | cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure 24 | ^^^^^^^^^^^^^^^^^^^^^^^^ `cell_x` escapes the closure body here 25 26note: No external requirements 27 --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:18:1 28 | 29LL | / fn case1() { 30LL | | let a = 0; 31LL | | let cell = Cell::new(&a); 32LL | | foo(cell, |cell_a, cell_x| { 33... | 34LL | | }) 35LL | | } 36 | |_^ 37 | 38 = note: defining type: case1 39 40note: External requirements 41 --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:35:15 42 | 43LL | foo(cell, |cell_a, cell_x| { 44 | _______________^ 45LL | | cell_x.set(cell_a.get()); // forces 'a: 'x, implies 'a = 'static -> borrow error 46LL | | }) 47 | |_____^ 48 | 49 = note: defining type: case2::{{closure}}#0 with closure substs [ 50 i32, 51 for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>)), 52 ] 53 = note: number of external vids: 2 54 = note: where '_#1r: '_#0r 55 56note: No external requirements 57 --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:28:1 58 | 59LL | / fn case2() { 60LL | | let a = 0; 61LL | | let cell = Cell::new(&a); 62LL | | 63... | 64LL | | }) 65LL | | } 66 | |_^ 67 | 68 = note: defining type: case2 69 70error[E0597]: `a` does not live long enough 71 --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:30:26 72 | 73LL | let cell = Cell::new(&a); 74 | ----------^^- 75 | | | 76 | | borrowed value does not live long enough 77 | argument requires that `a` is borrowed for `'static` 78... 79LL | } 80 | - `a` dropped here while still borrowed 81 82error: aborting due to 2 previous errors 83 84For more information about this error, try `rustc --explain E0597`.