-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
miri: normalize struct tail in ABI compat check
- Loading branch information
Lukas Markeffsky
committed
Feb 2, 2024
1 parent
bf3c6c5
commit 182fab7
Showing
2 changed files
with
25 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
20 changes: 20 additions & 0 deletions
20
src/tools/miri/tests/pass/function_calls/abi_compat_normalize.rs
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,20 @@ | ||
// regression test for an ICE: https://github.com/rust-lang/miri/issues/3282 | ||
|
||
trait Id { | ||
type Assoc: ?Sized; | ||
} | ||
|
||
impl<T: ?Sized> Id for T { | ||
type Assoc = T; | ||
} | ||
|
||
#[repr(transparent)] | ||
struct Foo<T: ?Sized> { | ||
field: <T as Id>::Assoc, | ||
} | ||
|
||
fn main() { | ||
let x = unsafe { std::mem::transmute::<fn(&str), fn(&Foo<str>)>(|_| ()) }; | ||
let foo: &Foo<str> = unsafe { &*("uwu" as *const str as *const Foo<str>) }; | ||
x(foo); | ||
} |