crashes: more tests v2

This commit is contained in:
Matthias Krüger 2024-12-12 22:55:31 +01:00
parent a94fce97e3
commit 7880abac44
11 changed files with 122 additions and 0 deletions

12
tests/crashes/133426.rs Normal file
View file

@ -0,0 +1,12 @@
//@ known-bug: #133426
fn a(
_: impl Iterator<
Item = [(); {
match *todo!() { ! };
}],
>,
) {
}
fn b(_: impl Iterator<Item = { match 0 { ! } }>) {}

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

@ -0,0 +1,11 @@
//@ known-bug: #133597
pub trait Foo2 {
fn boxed<'a: 'a>() -> impl Sized + FnOnce<()>;
}
impl Foo2 for () {}
fn f() -> impl FnOnce<()> { || () }
fn main() { () = f(); }

33
tests/crashes/133639.rs Normal file
View file

@ -0,0 +1,33 @@
//@ known-bug: #133639
#![feature(with_negative_coherence)]
#![feature(min_specialization)]
#![feature(generic_const_exprs)]
#![crate_type = "lib"]
use std::str::FromStr;
struct a<const b: bool>;
trait c {}
impl<const d: u32> FromStr for e<d>
where
a<{ d <= 2 }>: c,
{
type Err = ();
fn from_str(f: &str) -> Result<Self, Self::Err> {
unimplemented!()
}
}
struct e<const d: u32>;
impl<const d: u32> FromStr for e<d>
where
a<{ d <= 2 }>: c,
{
type Err = ();
fn from_str(f: &str) -> Result<Self, Self::Err> {
unimplemented!()
}
}

15
tests/crashes/133808.rs Normal file
View file

@ -0,0 +1,15 @@
//@ known-bug: #133808
#![feature(generic_const_exprs, transmutability)]
mod assert {
use std::mem::TransmuteFrom;
pub fn is_transmutable<Src, Dst>()
where
Dst: TransmuteFrom<Src>,
{
}
}
pub fn main() {}

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

@ -0,0 +1,13 @@
//@ known-bug: #133868
trait Foo {
type Assoc;
}
trait Bar {
fn method() -> impl Sized;
}
impl<T> Bar for T where <T as Foo>::Assoc: Sized
{
fn method() {}
}

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

@ -0,0 +1,9 @@
//@ known-bug: #133965
//@ needs-rustc-debug-assertions
struct NonGeneric {}
#[derive(Default)]
struct NonGeneric<'a, const N: usize> {}
pub fn main() {}

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

@ -0,0 +1,3 @@
//@ known-bug: #133966
pub struct Data([[&'static str]; 5_i32]);
const _: &'static Data = unsafe { &*(&[] as *const Data) };

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

@ -0,0 +1,5 @@
//@ known-bug: #134005
fn main() {
let _ = [std::ops::Add::add, std::ops::Mul::mul, main as fn(_, &_)];
}

4
tests/crashes/134061.rs Normal file
View file

@ -0,0 +1,4 @@
//@ known-bug: #134061
//@ needs-rustc-debug-assertions
const x: () = |&'a

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

@ -0,0 +1,8 @@
//@ known-bug: #134162
fn main() {
struct X;
let xs = [X, X, X];
let eq = xs == [panic!("panic evaluated"); 2];
}

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

@ -0,0 +1,9 @@
//@ known-bug: #134217
impl<A> std::ops::CoerceUnsized<A> for A {}
fn main() {
if let _ = true
&& true
{}
}