diff options
| author | Stuart Cook <Zalathar@users.noreply.github.com> | 2025-09-29 11:56:42 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-29 11:56:42 +1000 |
| commit | 01b172ef33ff2aaaa11ed36cfed7cceedc214423 (patch) | |
| tree | d52fcc2adc02444f5f509574cdf7ecc56def6665 /tests | |
| parent | 5373eb12683174e3567067edbe03b704dc99a6cb (diff) | |
| parent | 7a7cb05f11a81e261e22f9ae291755b6343f7095 (diff) | |
| download | rust-01b172ef33ff2aaaa11ed36cfed7cceedc214423.tar.gz rust-01b172ef33ff2aaaa11ed36cfed7cceedc214423.zip | |
Rollup merge of #147092 - cjgillot:late-validate-mir, r=compiler-errors
Do not compute optimized MIR if code does not type-check. Since https://github.com/rust-lang/rust/pull/128612, we compute optimized MIR when `-Zvalidate-mir` is present. This is done as part of required analyses, even if type-checking fails. This causes ICEs, as most of the mir-opt pipeline expects well-formed code. Fixes rust-lang/rust#129095 Fixes rust-lang/rust#134174 Fixes rust-lang/rust#134654 Fixes rust-lang/rust#135570 Fixes rust-lang/rust#136381 Fixes rust-lang/rust#137468 Fixes rust-lang/rust#144491 Fixes rust-lang/rust#147011 This does not fix issue rust-lang/rust#137190, as it ICEs without `-Zvalidate-mir`. r? ``@compiler-errors``
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/crashes/129095.rs | 13 | ||||
| -rw-r--r-- | tests/crashes/134174.rs | 17 | ||||
| -rw-r--r-- | tests/crashes/134654.rs | 15 | ||||
| -rw-r--r-- | tests/crashes/135570.rs | 15 | ||||
| -rw-r--r-- | tests/crashes/136381.rs | 18 | ||||
| -rw-r--r-- | tests/crashes/137190-1.rs | 10 | ||||
| -rw-r--r-- | tests/crashes/137468.rs | 16 |
7 files changed, 0 insertions, 104 deletions
diff --git a/tests/crashes/129095.rs b/tests/crashes/129095.rs deleted file mode 100644 index b1bb74708c2..00000000000 --- a/tests/crashes/129095.rs +++ /dev/null @@ -1,13 +0,0 @@ -//@ known-bug: rust-lang/rust#129095 -//@ compile-flags: -Zmir-enable-passes=+GVN -Zmir-enable-passes=+Inline -Zvalidate-mir - -#![feature(adt_const_params, unsized_const_params)] -#![allow(incomplete_features)] - -pub fn function_with_bytes<const BYTES: &'static [u8; 4]>() -> &'static [u8] { - BYTES -} - -pub fn main() { - assert_eq!(function_with_bytes::<b"AAAAA">(), &[0x41, 0x41, 0x41, 0x41]); -} diff --git a/tests/crashes/134174.rs b/tests/crashes/134174.rs deleted file mode 100644 index 899cdc6faf3..00000000000 --- a/tests/crashes/134174.rs +++ /dev/null @@ -1,17 +0,0 @@ -//@ known-bug: #134175 -//@compile-flags: -Zvalidate-mir -Zinline-mir=yes -use std::vec::IntoIter; - -pub(crate) trait Foo: Iterator<Item = <Self as Foo>::Key> { - type Key; -} - -impl Foo for IntoIter<i16> {} - -fn sum_foo<F: Foo<Key = i32>>(f: F) -> i32 { - f.fold(0, |a, b| a + b) -} - -fn main() { - let x = sum_foo(vec![11, 10, 1].into_iter()); -} diff --git a/tests/crashes/134654.rs b/tests/crashes/134654.rs deleted file mode 100644 index f2323fe4ecd..00000000000 --- a/tests/crashes/134654.rs +++ /dev/null @@ -1,15 +0,0 @@ -//@ known-bug: #134654 -//@ compile-flags: -Zmir-enable-passes=+GVN -Zmir-enable-passes=+Inline -Zvalidate-mir -//@ only-x86_64 - -#![feature(adt_const_params, unsized_const_params)] -#![allow(incomplete_features)] - -fn function_with_bytes<const BYTES: - &'static [u8; 0xa9008fb6c9d81e42_0e25730562a601c8_u128]>() -> &'static [u8] { - BYTES -} - -fn main() { - function_with_bytes::<b"aa">() == &[]; -} diff --git a/tests/crashes/135570.rs b/tests/crashes/135570.rs deleted file mode 100644 index 7919ceb26d5..00000000000 --- a/tests/crashes/135570.rs +++ /dev/null @@ -1,15 +0,0 @@ -//@ known-bug: #135570 -//@compile-flags: -Zvalidate-mir -Zmir-enable-passes=+Inline -Copt-level=0 -Zmir-enable-passes=+GVN -//@ only-x86_64 - -#![feature(adt_const_params, unsized_const_params)] -#![allow(incomplete_features)] - -fn function_with_bytes<const BYTES: &'static [u8; 0xc7b889180b67b07d_bc1a3c88783d35b5_u128]>( -) -> &'static [u8] { - BYTES -} - -fn main() { - function_with_bytes::<b"aa">() == &[]; -} diff --git a/tests/crashes/136381.rs b/tests/crashes/136381.rs deleted file mode 100644 index 13ccc14a2c5..00000000000 --- a/tests/crashes/136381.rs +++ /dev/null @@ -1,18 +0,0 @@ -//@ known-bug: #136381 -//@ compile-flags: -Zvalidate-mir -Zmir-enable-passes=+GVN -#![feature(trait_upcasting)] - -trait A {} -trait B: A { - fn c(&self); -} -impl B for i32 { - fn c(self) { - todo!(); - } -} - -fn main() { - let baz: &dyn B = &1; - let bar: &dyn A = baz; -} diff --git a/tests/crashes/137190-1.rs b/tests/crashes/137190-1.rs deleted file mode 100644 index bdfe883b712..00000000000 --- a/tests/crashes/137190-1.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ known-bug: #137190 -//@ compile-flags: -Zmir-opt-level=2 -Zvalidate-mir -trait A { - fn b(&self); -} -trait C: A {} -impl C for () {} -fn main() { - (&() as &dyn C as &dyn A).b(); -} diff --git a/tests/crashes/137468.rs b/tests/crashes/137468.rs deleted file mode 100644 index cceb0502bd2..00000000000 --- a/tests/crashes/137468.rs +++ /dev/null @@ -1,16 +0,0 @@ -//@ known-bug: #137468 -//@ compile-flags: -Copt-level=0 -Zmir-enable-passes=+GVN -Zvalidate-mir -trait Supertrait<T> {} - -trait Identity { - type Selff; -} - -trait Trait<P>: Supertrait<()> + Supertrait<<P as Identity>::Selff> {} - -impl<P> Trait<P> for () {} - -fn main() { - let x: &dyn Trait<()> = &(); - let x: &dyn Supertrait<()> = x; -} |
