forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
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 rust-lang#99124 - compiler-errors:issue-99122, r=oli-obk
Fix sized check ICE in asm check Fixes (beta nominated, so doesn't close) rust-lang#99122
- Loading branch information
Showing
4 changed files
with
52 additions
and
21 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 @@ | ||
// check-pass | ||
// This demonstrates why we need to erase regions before sized check in intrinsicck | ||
|
||
struct NoCopy; | ||
|
||
struct Wrap<'a, T, Tail: ?Sized>(&'a T, Tail); | ||
|
||
pub unsafe fn test() { | ||
let i = NoCopy; | ||
let j = Wrap(&i, ()); | ||
let pointer = &j as *const _; | ||
core::arch::asm!( | ||
"nop", | ||
in("eax") pointer, | ||
); | ||
} | ||
|
||
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,10 @@ | ||
pub unsafe fn test() { | ||
let pointer = 1u32 as *const _; | ||
//~^ ERROR cannot cast to a pointer of an unknown kind | ||
core::arch::asm!( | ||
"nop", | ||
in("eax") pointer, | ||
); | ||
} | ||
|
||
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,11 @@ | ||
error[E0641]: cannot cast to a pointer of an unknown kind | ||
--> $DIR/issue-99122.rs:2:27 | ||
| | ||
LL | let pointer = 1u32 as *const _; | ||
| ^^^^^^^^ needs more type information | ||
| | ||
= note: the type information given here is insufficient to check whether the pointer cast is valid | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0641`. |