Skip to content

crashes: add lastest batch of crash tests #124775

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 8, 2024
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
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 || {};
}
Loading