File tree Expand file tree Collapse file tree 4 files changed +20
-6
lines changed Expand file tree Collapse file tree 4 files changed +20
-6
lines changed Original file line number Diff line number Diff line change 11error[E0308]: mismatched types
2- --> $DIR/issue-78262.rs:12 :28
2+ --> $DIR/issue-78262.rs:14 :28
33 |
44LL | let f = |x: &dyn TT| x.func();
55 | ^^^^ lifetime mismatch
66 |
77 = note: expected reference `&(dyn TT + 'static)`
88 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
1111 |
1212LL | let f = |x: &dyn TT| x.func();
1313 | ^^^^^^^^^^^^^^^^^^^^^
Original file line number Diff line number Diff line change 11error[E0521]: borrowed data escapes outside of closure
2- --> $DIR/issue-78262.rs:12 :26
2+ --> $DIR/issue-78262.rs:14 :26
33 |
44LL | let f = |x: &dyn TT| x.func();
55 | - ^^^^^^^^ `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
22// 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
46
57trait TT { }
68
@@ -11,4 +13,5 @@ impl dyn TT {
1113fn main ( ) {
1214 let f = |x : & dyn TT | x. func ( ) ; //[default]~ ERROR: mismatched types
1315 //[nll]~^ ERROR: borrowed data escapes outside of closure
16+ //[polonius]~^^ ERROR: borrowed data escapes outside of closure
1417}
You can’t perform that action at this time.
0 commit comments