Skip to content

more ice tests #141225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions tests/crashes/139905.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 11 additions & 0 deletions tests/crashes/140011.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 6 additions & 0 deletions tests/crashes/140099.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 7 additions & 0 deletions tests/crashes/140100.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//@ known-bug: #140100
fn a()
where
b: Sized,
{
println!()
}
12 changes: 12 additions & 0 deletions tests/crashes/140123-2.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 10 additions & 0 deletions tests/crashes/140123-3.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 13 additions & 0 deletions tests/crashes/140123-4.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 10 additions & 0 deletions tests/crashes/140123.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 3 additions & 0 deletions tests/crashes/140255.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//@ known-bug: #140255
#[unsafe(macro_use::VAR2)]
fn dead_code() {}
5 changes: 5 additions & 0 deletions tests/crashes/140275.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 18 additions & 0 deletions tests/crashes/140281.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 22 additions & 0 deletions tests/crashes/140303.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 9 additions & 0 deletions tests/crashes/140333.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//@ known-bug: #140333
fn a() -> impl b<
[c; {
struct d {
#[a]
bar: e,
}
}],
>;
8 changes: 8 additions & 0 deletions tests/crashes/140365.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//@ known-bug: #140365
//@compile-flags: -C opt-level=1 -Zvalidate-mir
fn f() -> &'static str
where
Self: Sized,
{
""
}
16 changes: 16 additions & 0 deletions tests/crashes/140381.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 6 additions & 0 deletions tests/crashes/140429.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 5 additions & 0 deletions tests/crashes/140479.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//@ known-bug: #140479
macro_rules! a { ( $( { $ [ $b:c ] } )) => ( $(${ concat(d, $b)} ))}
fn e() {
a!({})
}
14 changes: 14 additions & 0 deletions tests/crashes/140484.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 14 additions & 0 deletions tests/crashes/140500.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 8 additions & 0 deletions tests/crashes/140530.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//@ known-bug: #140530
//@ edition: 2024

#![feature(async_drop, gen_blocks)]
async gen fn a() {
_ = async {}
}
fn main() {}
7 changes: 7 additions & 0 deletions tests/crashes/140531.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 14 additions & 0 deletions tests/crashes/140571.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 32 additions & 0 deletions tests/crashes/140577.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 13 additions & 0 deletions tests/crashes/140609.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 8 additions & 0 deletions tests/crashes/140642.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 5 additions & 0 deletions tests/crashes/140683.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//@ known-bug: #140683
impl T {
#[core::contracts::ensures]
fn b() { (loop) }
}
11 changes: 11 additions & 0 deletions tests/crashes/140729.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 9 additions & 0 deletions tests/crashes/140823.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 7 additions & 0 deletions tests/crashes/140850.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//@ known-bug: #140850
//@ compile-flags: -Zvalidate-mir
fn A() -> impl {
while A() {}
loop {}
}
fn main() {}
10 changes: 10 additions & 0 deletions tests/crashes/140860.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 6 additions & 0 deletions tests/crashes/140884.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//@ known-bug: #140884
//@ needs-rustc-debug-assertions

fn a() {
extern "" {}
}
6 changes: 6 additions & 0 deletions tests/crashes/140891.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 14 additions & 0 deletions tests/crashes/140974.rs
Original file line number Diff line number Diff line change
@@ -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..
}
Loading
Loading