Skip to content

Commit

Permalink
Rollup merge of rust-lang#129780 - cyrgani:master, r=compiler-errors
Browse files Browse the repository at this point in the history
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 rust-lang#128097, rust-lang#119095, rust-lang#117460 and rust-lang#126443.
  • Loading branch information
matthiaskrgr authored Sep 1, 2024
2 parents d24336b + fff063e commit f040e68
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/crashes/117460.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//@ known-bug: #117460
#![feature(generic_const_exprs)]

struct Matrix<D = [(); 2 + 2]> {
d: D,
}

impl Matrix {}
48 changes: 48 additions & 0 deletions tests/crashes/119095.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 15 additions & 0 deletions tests/crashes/126443.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 6 additions & 0 deletions tests/crashes/128097.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//@ known-bug: #128097
#![feature(explicit_tail_calls)]
fn f(x: &mut ()) {
let _y: String;
become f(x);
}

0 comments on commit f040e68

Please sign in to comment.