forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not try to report on closures to avoid ICE
- Loading branch information
Showing
3 changed files
with
35 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,9 @@ | ||
trait TT {} | ||
|
||
impl dyn TT { | ||
fn func(&self) {} | ||
} | ||
|
||
fn main() { | ||
let f = |x: &dyn TT| x.func(); //~ ERROR: mismatched types | ||
} |
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:8: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 | ||
| | ||
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`. |