File tree 3 files changed +19
-4
lines changed
3 files changed +19
-4
lines changed Original file line number Diff line number Diff line change 1
1
error[E0308]: mismatched types
2
- --> $DIR/issue-78262.rs:8 :28
2
+ --> $DIR/issue-78262.rs:12 :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 8 :13...
10
- --> $DIR/issue-78262.rs:8 :13
9
+ note: the anonymous lifetime #1 defined on the body at 12 :13...
10
+ --> $DIR/issue-78262.rs:12 :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
+ error[E0521]: borrowed data escapes outside of closure
2
+ --> $DIR/issue-78262.rs:12: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
+
Original file line number Diff line number Diff line change
1
+ // revisions: nll default
2
+ // ignore-compare-mode-nll
3
+ //[nll]compile-flags: -Z borrowck=mir
4
+
1
5
trait TT { }
2
6
3
7
impl dyn TT {
4
8
fn func ( & self ) { }
5
9
}
6
10
7
11
fn main ( ) {
8
- let f = |x : & dyn TT | x. func ( ) ; //~ ERROR: mismatched types
12
+ let f = |x : & dyn TT | x. func ( ) ; //[default]~ ERROR: mismatched types
13
+ //[nll]~^ ERROR: borrowed data escapes outside of closure
9
14
}
You can’t perform that action at this time.
0 commit comments