-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #78268 - JohnTitor:issue-78262, r=estebank
Do not try to report on closures to avoid ICE Fixes #78262
- Loading branch information
Showing
4 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
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,18 @@ | ||
error[E0308]: mismatched types | ||
--> $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 12:13... | ||
--> $DIR/issue-78262.rs:12:13 | ||
| | ||
LL | let f = |x: &dyn TT| x.func(); | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
= note: ...does not necessarily outlive the static lifetime | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
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 |
---|---|---|
@@ -0,0 +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(); //[default]~ ERROR: mismatched types | ||
//[nll]~^ ERROR: borrowed data escapes outside of closure | ||
} |