crashes: add lastest batch of crash tests

This commit is contained in:
Matthias Krüger 2024-05-05 23:41:08 +02:00
parent 872a85658d
commit 397a35d081
9 changed files with 148 additions and 0 deletions

7
tests/crashes/124436.rs Normal file
View File

@ -0,0 +1,7 @@
//@ known-bug: rust-lang/rust#124436
//@ compile-flags: -Zdump-mir=all -Zpolymorphize=on
pub trait TraitCat {}
pub trait TraitDog {}
pub fn gamma<T: TraitCat + TraitDog>(t: [TraitDog; 32]) {}

23
tests/crashes/124440.rs Normal file
View File

@ -0,0 +1,23 @@
//@ known-bug: rust-lang/rust#124440
#![allow(warnings)]
trait Foo {}
impl<F> Foo for F where F: FnMut(&()) {}
struct Bar<F> {
f: F,
}
impl<F> Foo for Bar<F> where F: Foo {}
fn assert_foo<F>(_: F)
where
Bar<F>: Foo,
{
}
fn main() {
assert_foo(|_| ());
}

17
tests/crashes/124464.rs Normal file
View File

@ -0,0 +1,17 @@
//@ known-bug: rust-lang/rust #124464
enum TestOption<T> {
TestSome(T),
TestSome(T),
}
pub struct Request {
bar: TestOption<u64>,
bar: u8,
}
fn default_instance() -> &'static Request {
static instance: Request = Request { bar: 17 };
&instance
}
pub fn main() {}

16
tests/crashes/124490.rs Normal file
View File

@ -0,0 +1,16 @@
//@ known-bug: rust-lang/rust#124490
use io::{self as std};
use std::collections::{self as io};
mod a {
pub mod b {
pub mod c {}
}
}
use a::*;
use b::c;
use c as b;
fn main() {}

12
tests/crashes/124552.rs Normal file
View File

@ -0,0 +1,12 @@
//@ known-bug: rust-lang/rust#124552
struct B;
struct Foo {
b: u32,
b: B,
}
static BAR: Foo = Foo { b: B };
fn main() {}

46
tests/crashes/124563.rs Normal file
View File

@ -0,0 +1,46 @@
//@ known-bug: rust-lang/rust#124563
use std::marker::PhantomData;
pub trait Trait {}
pub trait Foo {
type Trait: Trait;
type Bar: Bar;
fn foo(&mut self);
}
pub struct FooImpl<'a, 'b, A: Trait>(PhantomData<&'a &'b A>);
impl<'a, 'b, T> Foo for FooImpl<'a, 'b, T>
where
T: Trait,
{
type Trait = T;
type Bar = BarImpl<'a, 'b, T>;
fn foo(&mut self) {
self.enter_scope(|ctx| {
BarImpl(ctx);
});
}
}
impl<'a, 'b, T> FooImpl<'a, 'b, T>
where
T: Trait,
{
fn enter_scope(&mut self, _scope: impl FnOnce(&mut Self)) {}
}
pub trait Bar {
type Foo: Foo;
}
pub struct BarImpl<'a, 'b, T: Trait>(&'b mut FooImpl<'a, 'b, T>);
impl<'a, 'b, T> Bar for BarImpl<'a, 'b, T>
where
T: Trait,
{
type Foo = FooImpl<'a, 'b, T>;
}

5
tests/crashes/124583.rs Normal file
View File

@ -0,0 +1,5 @@
//@ known-bug: rust-lang/rust#124583
fn main() {
let _ = -(-0.0f16);
}

14
tests/crashes/124702.rs Normal file
View File

@ -0,0 +1,14 @@
//@ known-bug: rust-lang/rust#124702
//@ compile-flags: -Znext-solver=coherence
trait X {}
trait Z {
type Assoc: Y;
}
struct A<T>(T);
impl<T: X> Z for A<T> {
type Assoc = T;
}
impl<T> From<<A<A<T>> as Z>::Assoc> for T {}

8
tests/crashes/124751.rs Normal file
View File

@ -0,0 +1,8 @@
//@ known-bug: rust-lang/rust#124751
//@ compile-flags: -Zunstable-options --edition=2024
#![feature(gen_blocks)]
fn main() {
let _ = async gen || {};
}