File tree Expand file tree Collapse file tree 1 file changed +9
-13
lines changed Expand file tree Collapse file tree 1 file changed +9
-13
lines changed Original file line number Diff line number Diff line change 1
- error[E0308 ]: mismatched types
2
- --> $DIR/ice-6256.rs:13:28
1
+ error[E0521 ]: borrowed data escapes outside of closure
2
+ --> $DIR/ice-6256.rs:13:26
3
3
|
4
4
LL | let f = |x: &dyn TT| x.func(); //[default]~ ERROR: mismatched types
5
- | ^^^^ lifetime mismatch
6
- |
7
- = note: expected reference `&(dyn TT + 'static)`
8
- found reference `&dyn TT`
9
- note: the anonymous lifetime #1 defined here...
10
- --> $DIR/ice-6256.rs:13:13
11
- |
12
- LL | let f = |x: &dyn TT| x.func(); //[default]~ ERROR: mismatched types
13
- | ^^^^^^^^^^^^^^^^^^^^^
14
- = note: ...does not necessarily outlive the static lifetime
5
+ | - - ^^^^^^^^
6
+ | | | |
7
+ | | | `x` escapes the closure body here
8
+ | | | argument requires that `'1` must outlive `'static`
9
+ | | let's call the lifetime of this reference `'1`
10
+ | `x` is a reference that is only valid in the closure body
15
11
16
12
error: aborting due to previous error
17
13
18
- For more information about this error, try `rustc --explain E0308 `.
14
+ For more information about this error, try `rustc --explain E0521 `.
You can’t perform that action at this time.
0 commit comments