Rollup merge of #129780 - cyrgani:master, r=compiler-errors

add crashtests for several old unfixed ICEs

Adds several new crashtests for some older ICEs that did not yet have any.
Tests were added for #128097, #119095, #117460 and #126443.
This commit is contained in:
Matthias Krüger 2024-09-01 03:58:05 +02:00 committed by GitHub
commit f040e689c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 77 additions and 0 deletions

8
tests/crashes/117460.rs Normal file
View File

@ -0,0 +1,8 @@
//@ known-bug: #117460
#![feature(generic_const_exprs)]
struct Matrix<D = [(); 2 + 2]> {
d: D,
}
impl Matrix {}

48
tests/crashes/119095.rs Normal file
View File

@ -0,0 +1,48 @@
//@ known-bug: #119095
//@ compile-flags: --edition=2021
fn any<T>() -> T {
loop {}
}
trait Acquire {
type Connection;
}
impl Acquire for &'static () {
type Connection = ();
}
trait Unit {}
impl Unit for () {}
fn get_connection<T>() -> impl Unit
where
T: Acquire,
T::Connection: Unit,
{
any::<T::Connection>()
}
fn main() {
let future = async { async { get_connection::<&'static ()>() }.await };
future.resolve_me();
}
trait ResolveMe {
fn resolve_me(self);
}
impl<S> ResolveMe for S
where
(): CheckSend<S>,
{
fn resolve_me(self) {}
}
trait CheckSend<F> {}
impl<F> CheckSend<F> for () where F: Send {}
trait NeverImplemented {}
impl<E, F> CheckSend<F> for E where E: NeverImplemented {}

15
tests/crashes/126443.rs Normal file
View File

@ -0,0 +1,15 @@
//@ known-bug: #126443
//@ compile-flags: -Copt-level=0
#![feature(generic_const_exprs)]
fn double_up<const M: usize>() -> [(); M * 2] {
todo!()
}
fn quadruple_up<const N: usize>() -> [(); N * 2 * 2] {
double_up()
}
fn main() {
quadruple_up::<0>();
}

6
tests/crashes/128097.rs Normal file
View File

@ -0,0 +1,6 @@
//@ known-bug: #128097
#![feature(explicit_tail_calls)]
fn f(x: &mut ()) {
let _y: String;
become f(x);
}