File tree 4 files changed +20
-6
lines changed
4 files changed +20
-6
lines changed Original file line number Diff line number Diff line change 1
1
error[E0308]: mismatched types
2
- --> $DIR/issue-78262.rs:12 :28
2
+ --> $DIR/issue-78262.rs:14 :28
3
3
|
4
4
LL | let f = |x: &dyn TT| x.func();
5
5
| ^^^^ lifetime mismatch
6
6
|
7
7
= note: expected reference `&(dyn TT + 'static)`
8
8
found reference `&dyn TT`
9
- note: the anonymous lifetime #1 defined on the body at 12 :13...
10
- --> $DIR/issue-78262.rs:12 :13
9
+ note: the anonymous lifetime #1 defined on the body at 14 :13...
10
+ --> $DIR/issue-78262.rs:14 :13
11
11
|
12
12
LL | let f = |x: &dyn TT| x.func();
13
13
| ^^^^^^^^^^^^^^^^^^^^^
Original file line number Diff line number Diff line change 1
1
error[E0521]: borrowed data escapes outside of closure
2
- --> $DIR/issue-78262.rs:12 :26
2
+ --> $DIR/issue-78262.rs:14 :26
3
3
|
4
4
LL | let f = |x: &dyn TT| x.func();
5
5
| - ^^^^^^^^ `x` escapes the closure body here
Original file line number Diff line number Diff line change
1
+ error[E0521]: borrowed data escapes outside of closure
2
+ --> $DIR/issue-78262.rs:14:26
3
+ |
4
+ LL | let f = |x: &dyn TT| x.func();
5
+ | - ^^^^^^^^ `x` escapes the closure body here
6
+ | |
7
+ | `x` is a reference that is only valid in the closure body
8
+
9
+ error: aborting due to previous error
10
+
11
+ For more information about this error, try `rustc --explain E0521`.
Original file line number Diff line number Diff line change 1
- // revisions: nll default
1
+ // revisions: default nll polonius
2
2
// ignore-compare-mode-nll
3
- //[nll]compile-flags: -Z borrowck=mir
3
+ // ignore-compare-mode-polonius
4
+ // [nll] compile-flags: -Z borrowck=mir
5
+ // [polonius] compile-flags: -Z borrowck=mir -Z polonius
4
6
5
7
trait TT { }
6
8
@@ -11,4 +13,5 @@ impl dyn TT {
11
13
fn main ( ) {
12
14
let f = |x : & dyn TT | x. func ( ) ; //[default]~ ERROR: mismatched types
13
15
//[nll]~^ ERROR: borrowed data escapes outside of closure
16
+ //[polonius]~^^ ERROR: borrowed data escapes outside of closure
14
17
}
You can’t perform that action at this time.
0 commit comments