Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[const prop] Fix "alloc id without corresponding allocation" ICE
Fixes #66345
- Loading branch information
1 parent
c5e762f
commit 2b6815a
Showing
6 changed files
with
32 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// run-pass | ||
// compile-flags: -Z mir-opt-level=3 | ||
|
||
// Checks that the compiler does not ICE when passing references to field of by-value struct | ||
// with -Z mir-opt-level=3 | ||
|
||
fn do_nothing(_: &()) {} | ||
|
||
pub struct Foo { | ||
bar: (), | ||
} | ||
|
||
pub fn by_value_1(foo: Foo) { | ||
do_nothing(&foo.bar); | ||
} | ||
|
||
pub fn by_value_2<T>(foo: Foo) { | ||
do_nothing(&foo.bar); | ||
} | ||
|
||
fn main() { | ||
by_value_1(Foo { bar: () }); | ||
by_value_2::<()>(Foo { bar: () }); | ||
} |