mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-13 07:24:00 +00:00
Test with NLL explicitly
This commit is contained in:
parent
7b4c397b73
commit
4ec396ea5d
@ -1,13 +1,13 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-78262.rs:8:28
|
||||
--> $DIR/issue-78262.rs:12:28
|
||||
|
|
||||
LL | let f = |x: &dyn TT| x.func();
|
||||
| ^^^^ lifetime mismatch
|
||||
|
|
||||
= note: expected reference `&(dyn TT + 'static)`
|
||||
found reference `&dyn TT`
|
||||
note: the anonymous lifetime #1 defined on the body at 8:13...
|
||||
--> $DIR/issue-78262.rs:8:13
|
||||
note: the anonymous lifetime #1 defined on the body at 12:13...
|
||||
--> $DIR/issue-78262.rs:12:13
|
||||
|
|
||||
LL | let f = |x: &dyn TT| x.func();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
10
src/test/ui/regions/issue-78262.nll.stderr
Normal file
10
src/test/ui/regions/issue-78262.nll.stderr
Normal file
@ -0,0 +1,10 @@
|
||||
error[E0521]: borrowed data escapes outside of closure
|
||||
--> $DIR/issue-78262.rs:12:26
|
||||
|
|
||||
LL | let f = |x: &dyn TT| x.func();
|
||||
| - ^^^^^^^^ `x` escapes the closure body here
|
||||
| |
|
||||
| `x` is a reference that is only valid in the closure body
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -1,3 +1,7 @@
|
||||
// revisions: nll default
|
||||
// ignore-compare-mode-nll
|
||||
//[nll]compile-flags: -Z borrowck=mir
|
||||
|
||||
trait TT {}
|
||||
|
||||
impl dyn TT {
|
||||
@ -5,5 +9,6 @@ impl dyn TT {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let f = |x: &dyn TT| x.func(); //~ ERROR: mismatched types
|
||||
let f = |x: &dyn TT| x.func(); //[default]~ ERROR: mismatched types
|
||||
//[nll]~^ ERROR: borrowed data escapes outside of closure
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user