Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 0443a66

Browse files
committed
more ice tests
1 parent ae3b909 commit 0443a66

36 files changed

+396
-0
lines changed

tests/crashes/139905.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//@ known-bug: #139905
2+
trait a<const b: bool> {}
3+
impl a<{}> for () {}
4+
trait c {}
5+
impl<const d: u8> c for () where (): a<d> {}
6+
impl c for () {}

tests/crashes/140011.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//@ known-bug: #140011
2+
//@compile-flags: -Wrust-2021-incompatible-closure-captures
3+
enum b {
4+
c(d),
5+
e(f),
6+
}
7+
struct f;
8+
fn g() {
9+
let h;
10+
|| b::e(a) = h;
11+
}

tests/crashes/140099.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//@ known-bug: #140099
2+
struct a;
3+
impl From for a where for<'any> &'any mut (): Clone {}
4+
fn b() -> Result<(), std::convert::Infallible> {
5+
|| -> Result<_, a> { b()? }
6+
}

tests/crashes/140100.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//@ known-bug: #140100
2+
fn a()
3+
where
4+
b: Sized,
5+
{
6+
println!()
7+
}

tests/crashes/140123-2.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//@ known-bug: #140123
2+
//@ compile-flags: --crate-type lib
3+
4+
trait Trait {}
5+
6+
impl Trait for [(); 0] {}
7+
8+
const ICE: [&mut dyn Trait; 2] = [const { empty_mut() }; 2];
9+
10+
const fn empty_mut() -> &'static mut [(); 0] {
11+
&mut []
12+
}

tests/crashes/140123-3.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//@ known-bug: #140123
2+
//@ compile-flags: --crate-type lib
3+
4+
const ICE: [&mut [()]; 2] = [const { empty_mut() }; 2];
5+
6+
const fn empty_mut() -> &'static mut [()] {
7+
unsafe {
8+
std::slice::from_raw_parts_mut(std::ptr::dangling_mut(), 0)
9+
}
10+
}

tests/crashes/140123-4.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//@ known-bug: #140123
2+
//@ compile-flags: --crate-type lib
3+
4+
const ICE: [&mut [(); 0]; 2] = [const { empty_mut() }; 2];
5+
6+
const fn empty_mut() -> &'static mut [(); 0] {
7+
&mut []
8+
}
9+
// https://github.com/rust-lang/rust/issues/140123#issuecomment-2820664450
10+
const ICE2: [&mut [(); 0]; 2] = [const {
11+
let x = &mut [];
12+
x
13+
}; 2];

tests/crashes/140123.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//@ known-bug: #140123
2+
//@ compile-flags: --crate-type lib
3+
4+
const OK: [&mut [()]; 2] = [empty_mut(), empty_mut()];
5+
const ICE: [&mut [()]; 2] = [const { empty_mut() }; 2];
6+
7+
// Any kind of fn call gets around E0764.
8+
const fn empty_mut() -> &'static mut [()] {
9+
&mut []
10+
}

tests/crashes/140255.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
//@ known-bug: #140255
2+
#[unsafe(macro_use::VAR2)]
3+
fn dead_code() {}

tests/crashes/140275.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//@ known-bug: #140275
2+
#![feature(generic_const_exprs)]
3+
trait T{}
4+
trait V{}
5+
impl<const N: i32> T for [i32; N::<&mut V>] {}

0 commit comments

Comments
 (0)