-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
19 additions
and
4 deletions.
There are no files selected for viewing
6 changes: 3 additions & 3 deletions
6
src/test/ui/regions/issue-78262.stderr → ...est/ui/regions/issue-78262.default.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
// revisions: nll default | ||
// ignore-compare-mode-nll | ||
//[nll]compile-flags: -Z borrowck=mir | ||
|
||
trait TT {} | ||
|
||
impl dyn TT { | ||
fn func(&self) {} | ||
} | ||
|
||
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 | ||
} |