Skip to content

Commit

Permalink
Rollup merge of #124775 - matthiaskrgr:boom, r=jieyouxu
Browse files Browse the repository at this point in the history
crashes: add lastest batch of crash tests
  • Loading branch information
matthiaskrgr authored May 8, 2024
2 parents d8a3a69 + 397a35d commit 812fb24
Show file tree
Hide file tree
Showing 9 changed files with 148 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/crashes/124436.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 23 additions & 0 deletions tests/crashes/124440.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 17 additions & 0 deletions tests/crashes/124464.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 16 additions & 0 deletions tests/crashes/124490.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 12 additions & 0 deletions tests/crashes/124552.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 46 additions & 0 deletions tests/crashes/124563.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 5 additions & 0 deletions tests/crashes/124583.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//@ known-bug: rust-lang/rust#124583

fn main() {
let _ = -(-0.0f16);
}
14 changes: 14 additions & 0 deletions tests/crashes/124702.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 8 additions & 0 deletions tests/crashes/124751.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//@ known-bug: rust-lang/rust#124751
//@ compile-flags: -Zunstable-options --edition=2024

#![feature(gen_blocks)]

fn main() {
let _ = async gen || {};
}

0 comments on commit 812fb24

Please sign in to comment.