forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#108012 - compiler-errors:issue-107999, r=oli-obk
Don't ICE in `might_permit_raw_init` if reference is polymorphic Emitting optimized MIR for a polymorphic function may require computing layout of a type that isn't (yet) known. This happens in the instcombine pass, for example. Let's fail gracefully in that condition. cc `@saethlin` fixes rust-lang#107999
- Loading branch information
Showing
11 changed files
with
116 additions
and
56 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
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
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
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
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,23 @@ | ||
- // MIR for `generic` before InstCombine | ||
+ // MIR for `generic` after InstCombine | ||
|
||
fn generic() -> () { | ||
let mut _0: (); // return place in scope 0 at $DIR/dont_yeet_assert.rs:+0:21: +0:21 | ||
let _1: (); // in scope 0 at $DIR/dont_yeet_assert.rs:+1:5: +1:61 | ||
|
||
bb0: { | ||
StorageLive(_1); // scope 0 at $DIR/dont_yeet_assert.rs:+1:5: +1:61 | ||
_1 = assert_mem_uninitialized_valid::<&T>() -> bb1; // scope 0 at $DIR/dont_yeet_assert.rs:+1:5: +1:61 | ||
// mir::Constant | ||
// + span: $DIR/dont_yeet_assert.rs:10:5: 10:59 | ||
// + user_ty: UserType(0) | ||
// + literal: Const { ty: extern "rust-intrinsic" fn() {assert_mem_uninitialized_valid::<&T>}, val: Value(<ZST>) } | ||
} | ||
|
||
bb1: { | ||
StorageDead(_1); // scope 0 at $DIR/dont_yeet_assert.rs:+1:61: +1:62 | ||
_0 = const (); // scope 0 at $DIR/dont_yeet_assert.rs:+0:21: +2:2 | ||
return; // scope 0 at $DIR/dont_yeet_assert.rs:+2:2: +2:2 | ||
} | ||
} | ||
|
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 @@ | ||
// compile-flags: --crate-type=lib | ||
// unit-test: InstCombine | ||
|
||
#![feature(core_intrinsics)] | ||
|
||
// Want to make sure this assertion isn't compiled away in generic code. | ||
|
||
// EMIT_MIR dont_yeet_assert.generic.InstCombine.diff | ||
pub fn generic<T>() { | ||
core::intrinsics::assert_mem_uninitialized_valid::<&T>(); | ||
} |
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,8 @@ | ||
// compile-flags: --crate-type=lib -Zmir-enable-passes=+InstCombine | ||
// build-pass | ||
|
||
#![feature(core_intrinsics)] | ||
|
||
pub fn generic<T>() { | ||
core::intrinsics::assert_mem_uninitialized_valid::<&T>(); | ||
} |