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.
Rollup merge of rust-lang#109959 - JakobDegen:transmute-validate, r=c…
…ompiler-errors Fix transmute intrinsic mir validation ICE I stumbled across this at work, the minimal reproducer is included as a test which ICEs before this change. I'm not 100% sure this is the right fix, but it matches what we do in `mir_assign_valid_types` so seems reasonable at least. fixes rust-lang#110151 r? `@lcnr` since they've been keeping the relevant logic correct, cc `@scottmcm`
- Loading branch information
Showing
2 changed files
with
27 additions
and
2 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,17 @@ | ||
// build-pass | ||
// compile-flags: -Zvalidate-mir | ||
// edition: 2021 | ||
|
||
#![crate_type = "lib"] | ||
|
||
// Use `PhantomData` to get target-independent size | ||
async fn get(_r: std::marker::PhantomData<&i32>) { | ||
loop {} | ||
} | ||
|
||
pub fn check() { | ||
let mut v = get(loop {}); | ||
let _ = || unsafe { | ||
v = std::mem::transmute([0_u8; 1]); | ||
}; | ||
} |