-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
check type error recursively in typeck
- Loading branch information
1 parent
176e545
commit d5a99f3
Showing
3 changed files
with
76 additions
and
1 deletion.
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,13 @@ | ||
// issue #127742 | ||
struct Vtable(dyn Cap); | ||
//~^ ERROR missing lifetime specifier | ||
|
||
trait Cap<'a> {} | ||
|
||
union Transmute { | ||
t: u64, | ||
u: &'static Vtable, | ||
} | ||
|
||
const G: &'static Vtable = unsafe { Transmute { t: 1 }.u }; | ||
fn main() {} |
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,19 @@ | ||
error[E0106]: missing lifetime specifier | ||
--> $DIR/wide_ptr_transmute.rs:2:19 | ||
| | ||
LL | struct Vtable(dyn Cap); | ||
| ^^^ expected named lifetime parameter | ||
| | ||
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html | ||
help: consider making the bound lifetime-generic with a new `'a` lifetime | ||
| | ||
LL | struct Vtable(dyn for<'a> Cap<'a>); | ||
| +++++++ ++++ | ||
help: consider introducing a named lifetime parameter | ||
| | ||
LL | struct Vtable<'a>(dyn Cap<'a>); | ||
| ++++ ++++ | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0106`. |