more ice tests

This commit is contained in:
Matthias Krüger 2025-05-18 14:50:30 +02:00
parent ae3b909a32
commit 0443a66d39
36 changed files with 396 additions and 0 deletions

6
tests/crashes/139905.rs Normal file
View file

@ -0,0 +1,6 @@
//@ known-bug: #139905
trait a<const b: bool> {}
impl a<{}> for () {}
trait c {}
impl<const d: u8> c for () where (): a<d> {}
impl c for () {}

11
tests/crashes/140011.rs Normal file
View file

@ -0,0 +1,11 @@
//@ known-bug: #140011
//@compile-flags: -Wrust-2021-incompatible-closure-captures
enum b {
c(d),
e(f),
}
struct f;
fn g() {
let h;
|| b::e(a) = h;
}

6
tests/crashes/140099.rs Normal file
View file

@ -0,0 +1,6 @@
//@ known-bug: #140099
struct a;
impl From for a where for<'any> &'any mut (): Clone {}
fn b() -> Result<(), std::convert::Infallible> {
|| -> Result<_, a> { b()? }
}

7
tests/crashes/140100.rs Normal file
View file

@ -0,0 +1,7 @@
//@ known-bug: #140100
fn a()
where
b: Sized,
{
println!()
}

12
tests/crashes/140123-2.rs Normal file
View file

@ -0,0 +1,12 @@
//@ known-bug: #140123
//@ compile-flags: --crate-type lib
trait Trait {}
impl Trait for [(); 0] {}
const ICE: [&mut dyn Trait; 2] = [const { empty_mut() }; 2];
const fn empty_mut() -> &'static mut [(); 0] {
&mut []
}

10
tests/crashes/140123-3.rs Normal file
View file

@ -0,0 +1,10 @@
//@ known-bug: #140123
//@ compile-flags: --crate-type lib
const ICE: [&mut [()]; 2] = [const { empty_mut() }; 2];
const fn empty_mut() -> &'static mut [()] {
unsafe {
std::slice::from_raw_parts_mut(std::ptr::dangling_mut(), 0)
}
}

13
tests/crashes/140123-4.rs Normal file
View file

@ -0,0 +1,13 @@
//@ known-bug: #140123
//@ compile-flags: --crate-type lib
const ICE: [&mut [(); 0]; 2] = [const { empty_mut() }; 2];
const fn empty_mut() -> &'static mut [(); 0] {
&mut []
}
// https://github.com/rust-lang/rust/issues/140123#issuecomment-2820664450
const ICE2: [&mut [(); 0]; 2] = [const {
let x = &mut [];
x
}; 2];

10
tests/crashes/140123.rs Normal file
View file

@ -0,0 +1,10 @@
//@ known-bug: #140123
//@ compile-flags: --crate-type lib
const OK: [&mut [()]; 2] = [empty_mut(), empty_mut()];
const ICE: [&mut [()]; 2] = [const { empty_mut() }; 2];
// Any kind of fn call gets around E0764.
const fn empty_mut() -> &'static mut [()] {
&mut []
}

3
tests/crashes/140255.rs Normal file
View file

@ -0,0 +1,3 @@
//@ known-bug: #140255
#[unsafe(macro_use::VAR2)]
fn dead_code() {}

5
tests/crashes/140275.rs Normal file
View file

@ -0,0 +1,5 @@
//@ known-bug: #140275
#![feature(generic_const_exprs)]
trait T{}
trait V{}
impl<const N: i32> T for [i32; N::<&mut V>] {}

18
tests/crashes/140281.rs Normal file
View file

@ -0,0 +1,18 @@
//@ known-bug: #140281
macro_rules! foo {
($x:expr) => { $x }
}
fn main() {
let t = vec![
/// test RTL in doc in vec!
// ICE (Sadly)
1
];
foo!(
/// test RTL in doc in macro
1
);
}

22
tests/crashes/140303.rs Normal file
View file

@ -0,0 +1,22 @@
//@ known-bug: #140303
//@compile-flags: -Zvalidate-mir
use std::future::Future;
async fn a() -> impl Sized {
b(c)
}
async fn c(); // kaboom
fn b<d>(e: d) -> impl Sized
where
d: f,
{
|| -> <d>::h { panic!() }
}
trait f {
type h;
}
impl<d, g> f for d
where
d: Fn() -> g,
g: Future,
{
}

9
tests/crashes/140333.rs Normal file
View file

@ -0,0 +1,9 @@
//@ known-bug: #140333
fn a() -> impl b<
[c; {
struct d {
#[a]
bar: e,
}
}],
>;

8
tests/crashes/140365.rs Normal file
View file

@ -0,0 +1,8 @@
//@ known-bug: #140365
//@compile-flags: -C opt-level=1 -Zvalidate-mir
fn f() -> &'static str
where
Self: Sized,
{
""
}

16
tests/crashes/140381.rs Normal file
View file

@ -0,0 +1,16 @@
//@ known-bug: #140381
pub trait Foo<T> {}
pub trait Lend {
type From<'a>
where
Self: 'a;
fn lend(from: Self::From<'_>) -> impl Foo<Self::From<'_>>;
}
impl<T, F> Lend for (T, F) {
type From<'a> = ();
fn lend(from: Self::From<'_>) -> impl Foo<Self::From<'_>> {
from
}
}

6
tests/crashes/140429.rs Normal file
View file

@ -0,0 +1,6 @@
//@ known-bug: #140429
//@ compile-flags: -Zlint-mir --crate-type lib
//@ edition:2024
#![feature(async_drop)]
async fn a<T>(x: T) {}

5
tests/crashes/140479.rs Normal file
View file

@ -0,0 +1,5 @@
//@ known-bug: #140479
macro_rules! a { ( $( { $ [ $b:c ] } )) => ( $(${ concat(d, $b)} ))}
fn e() {
a!({})
}

14
tests/crashes/140484.rs Normal file
View file

@ -0,0 +1,14 @@
//@ known-bug: #140484
//@edition:2024
#![feature(async_drop)]
use std::future::AsyncDrop;
struct a;
impl Drop for a {
fn b() {}
}
impl AsyncDrop for a {
type c;
}
async fn bar() {
a;
}

14
tests/crashes/140500.rs Normal file
View file

@ -0,0 +1,14 @@
//@ known-bug: #140500
#![feature(async_drop)]
use std::future::AsyncDrop;
struct a;
impl Drop for a {
fn b() {}
}
impl AsyncDrop for a {
fn c(d: impl Sized) {}
}
async fn bar() {
a;
}

8
tests/crashes/140530.rs Normal file
View file

@ -0,0 +1,8 @@
//@ known-bug: #140530
//@ edition: 2024
#![feature(async_drop, gen_blocks)]
async gen fn a() {
_ = async {}
}
fn main() {}

7
tests/crashes/140531.rs Normal file
View file

@ -0,0 +1,7 @@
//@ known-bug: #140531
//@compile-flags: -Zlint-mir --crate-type lib
//@ edition:2024
#![feature(async_drop)]
async fn call_once(f: impl AsyncFnOnce()) {
let fut = Box::pin(f());
}

14
tests/crashes/140571.rs Normal file
View file

@ -0,0 +1,14 @@
//@ known-bug: #140571
pub trait IsVoid {
const IS_VOID: bool;
}
impl<T> IsVoid for T {
default const IS_VOID: bool = false;
}
impl<T> Maybe<T> for () where T: NotVoid + ?Sized {}
pub trait NotVoid {}
impl<T> NotVoid for T where T: IsVoid<IS_VOID = false> + ?Sized {}
pub trait Maybe<T> {}
impl<T> Maybe<T> for T {}

32
tests/crashes/140577.rs Normal file
View file

@ -0,0 +1,32 @@
//@ known-bug: #140577
//@ compile-flags: -Znext-solver=globally
//@ edition:2021
use std::future::Future;
use std::pin::Pin;
trait Acquire {
type Connection;
}
impl Acquire for &'static () {
type Connection = ();
}
fn b<T: Acquire>() -> impl Future + Send {
let x: Pin<Box<dyn Future<Output = T::Connection> + Send>> = todo!();
x
}
fn main() {
async {
b::<&()>().await;
}
.aa();
}
impl<F> Filter for F where F: Send {}
trait Filter {
fn aa(self)
where
Self: Sized,
{
}
}

13
tests/crashes/140609.rs Normal file
View file

@ -0,0 +1,13 @@
//@ known-bug: #140609
#![feature(with_negative_coherence)]
#![feature(generic_const_exprs)]
#![crate_type = "lib"]
trait Trait {}
struct A<const B: bool>;
trait C {}
impl<const D: u32> Trait for E<D> where A<{ D <= 2 }>: FnOnce(&isize) {}
struct E<const D: u32>;
impl<const D: u32> Trait for E<D> where A<{ D <= 2 }>: C {}

8
tests/crashes/140642.rs Normal file
View file

@ -0,0 +1,8 @@
//@ known-bug: #140642
#![feature(min_generic_const_args)]
pub trait Tr<A> {
const SIZE: usize;
}
fn mk_array(_x: T) -> [(); <T as Tr<bool>>::SIZE] {}

5
tests/crashes/140683.rs Normal file
View file

@ -0,0 +1,5 @@
//@ known-bug: #140683
impl T {
#[core::contracts::ensures]
fn b() { (loop) }
}

11
tests/crashes/140729.rs Normal file
View file

@ -0,0 +1,11 @@
//@ known-bug: #140729
#![feature(min_generic_const_args)]
const C: usize = 0;
pub struct A<const M: usize> {}
impl A<C> {
fn fun1() {}
}
impl A {
fn fun1() {}
}

9
tests/crashes/140823.rs Normal file
View file

@ -0,0 +1,9 @@
//@ known-bug: #140823
struct Container<T> {
data: T,
}
fn ice(callback: Box<dyn Fn(Container<&u8>)>) {
let fails: Box<dyn Fn(&Container<&u8>)> = callback;
}

7
tests/crashes/140850.rs Normal file
View file

@ -0,0 +1,7 @@
//@ known-bug: #140850
//@ compile-flags: -Zvalidate-mir
fn A() -> impl {
while A() {}
loop {}
}
fn main() {}

10
tests/crashes/140860.rs Normal file
View file

@ -0,0 +1,10 @@
//@ known-bug: #140860
#![feature(min_generic_const_args)]
#![feature(unsized_const_params)]
#![feature(with_negative_coherence, negative_impls)]
trait a < const b : &'static str> {} trait c {} struct d< e >(e);
impl<e> c for e where e: a<""> {}
impl<e> c for d<e> {}
impl<e> !a<f> for e {}
const f : &str = "";
fn main() {}

6
tests/crashes/140884.rs Normal file
View file

@ -0,0 +1,6 @@
//@ known-bug: #140884
//@ needs-rustc-debug-assertions
fn a() {
extern "" {}
}

6
tests/crashes/140891.rs Normal file
View file

@ -0,0 +1,6 @@
//@ known-bug: #140891
struct A<const N: usize> {}
impl<const N: usize> Iterator for A<N> {
fn next() -> [(); std::mem::size_of::<Option<Self::Item>>] {}
}
fn main() {}

14
tests/crashes/140974.rs Normal file
View file

@ -0,0 +1,14 @@
//@ known-bug: #140974
//@edition:2021
#![feature(async_drop)]
use core::future::AsyncDrop;
async fn fun(_: HasIncompleteAsyncDrop) {}
struct HasIncompleteAsyncDrop;
impl Drop for HasIncompleteAsyncDrop {
fn drop(&mut self) {}
}
impl AsyncDrop for HasIncompleteAsyncDrop {
// not implemented yet..
}

22
tests/crashes/140975.rs Normal file
View file

@ -0,0 +1,22 @@
//@ known-bug: #140975
//@ compile-flags: --crate-type lib -Zvalidate-mir
//@ edition: 2021
#![feature(async_drop)]
use std::{future::AsyncDrop, pin::Pin};
struct HasAsyncDrop ;
impl Drop for HasAsyncDrop {
fn drop(&mut self) {}
}
impl AsyncDrop for HasAsyncDrop {
async fn drop(self: Pin<&mut Self>) {}
}
struct Holder {
inner: HasAsyncDrop,
}
async fn bar() {
Holder {
inner: HasAsyncDrop
};
}

16
tests/crashes/141124.rs Normal file
View file

@ -0,0 +1,16 @@
//@ known-bug: #141124
struct S;
trait SimpleTrait {}
trait TraitAssoc {
type Assoc;
}
impl<T> TraitAssoc for T
where
T: SimpleTrait,
{
type Assoc = <(T,) as TraitAssoc>::Assoc;
}
impl SimpleTrait for <S as TraitAssoc>::Assoc {}
pub fn main() {}

13
tests/crashes/141143.rs Normal file
View file

@ -0,0 +1,13 @@
//@ known-bug: #141143
trait TypedClient {
fn publish_typed<F>(&self) -> impl Sized
where
F: Clone;
}
impl TypedClient for () {
fn publish_typed<F>(&self) -> impl Sized {}
}
fn main() {
().publish_typed();
}