Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaskrgr committed Mar 29, 2024
1 parent e473247 commit da8597f
Show file tree
Hide file tree
Showing 31 changed files with 664 additions and 1 deletion.
17 changes: 17 additions & 0 deletions tests/crashes/100041.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//@ known-bug: #100041

pub trait WellUnformed {
type RequestNormalize;
}

impl<T: ?Sized> WellUnformed for T {
type RequestNormalize = ();
}

pub fn latent(_: &[<[[()]] as WellUnformed>::RequestNormalize; 0]) {}

pub fn bang() {
latent(&[]);
}

fn main() {}
11 changes: 11 additions & 0 deletions tests/crashes/101962.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//@ known-bug: #101962

#![feature(core_intrinsics)]

pub fn wrapping<T: Copy>(a: T, b: T) {
let _z = core::intrinsics::wrapping_mul(a, b);
}

fn main() {
wrapping(1,2);
}
45 changes: 45 additions & 0 deletions tests/crashes/102047.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//@ known-bug: #102047

struct Ty1;
struct Ty2;

pub trait Trait<T> {}

pub trait WithAssoc1<'a> {
type Assoc;
}
pub trait WithAssoc2<'a> {
type Assoc;
}

impl<T, U> Trait<for<'a> fn(<T as WithAssoc1<'a>>::Assoc, <U as WithAssoc2<'a>>::Assoc)> for (T, U)
where
T: for<'a> WithAssoc1<'a> + for<'a> WithAssoc2<'a, Assoc = i32>,
U: for<'a> WithAssoc2<'a>,
{
}

impl WithAssoc1<'_> for Ty1 {
type Assoc = ();
}
impl WithAssoc2<'_> for Ty1 {
type Assoc = i32;
}
impl WithAssoc1<'_> for Ty2 {
type Assoc = ();
}
impl WithAssoc2<'_> for Ty2 {
type Assoc = u32;
}

fn foo<T, U, V>()
where
T: for<'a> WithAssoc1<'a>,
U: for<'a> WithAssoc2<'a>,
(T, U): Trait<V>,
{
}

fn main() {
foo::<Ty1, Ty2, _>();
}
14 changes: 14 additions & 0 deletions tests/crashes/102252.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//@ known-bug: #102252

#![feature(min_specialization, rustc_attrs)]

#[rustc_specialization_trait]
pub trait Trait {}

struct Struct
where
Self: Iterator<Item = <Self as Iterator>::Item>, {}

impl Trait for Struct {}

fn main() {}
27 changes: 27 additions & 0 deletions tests/crashes/103899.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//@ known-bug: #103899

trait BaseWithAssoc {
type Assoc;
}

trait WrapperWithAssoc {
type BaseAssoc: BaseWithAssoc;
}

struct Wrapper<B> {
inner: B,
}

struct ProjectToBase<T: BaseWithAssoc> {
data_type_h: T::Assoc,
}

struct DoubleProject<L: WrapperWithAssoc> {
buffer: Wrapper<ProjectToBase<L::BaseAssoc>>,
}

fn trigger<L: WrapperWithAssoc<BaseAssoc = ()>>() -> DoubleProject<L> {
loop {}
}

fn main() {}
31 changes: 31 additions & 0 deletions tests/crashes/105238-1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//@ known-bug: #105238

#![allow(incomplete_features)]
#![feature(generic_const_exprs)]

trait Ret {
type R;
}

struct Cond<const PRED: bool, U, V>(std::marker::PhantomData<U>, std::marker::PhantomData<V>);

impl<U, V> Ret for Cond<true, U, V> {
type R = U;
}

impl<U, V> Ret for Cond<false, U, V> {
type R = V;
}

struct RobinHashTable<const MAX_LENGTH: usize, CellIdx = Cond<{ MAX_LENGTH < 65535 }, u16, u32>>
where
CellIdx: Ret,
{
_idx: CellIdx::R,
}

fn main() {
use std::mem::size_of;
println!("{}", size_of::<RobinHashTable<1024>>());
println!("{}", size_of::<RobinHashTable<65536>>());
}
31 changes: 31 additions & 0 deletions tests/crashes/105238-2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//@ known-bug: #105238

#![allow(incomplete_features)]
#![feature(generic_const_exprs)]

trait Ret {
type R;
}

struct Cond<const PRED: bool, U, V>(std::marker::PhantomData<U>, std::marker::PhantomData<V>);

impl<U, V> Ret for Cond<true, U, V> {
type R = U;
}

impl<U, V> Ret for Cond<false, U, V> {
type R = V;
}

struct RobinHashTable<
const MAX_LENGTH: usize,
CellIdx = <Cond<{ MAX_LENGTH < 65535 }, u16, u32> as Ret>::R,
> {
_idx: CellIdx,
}

fn main() {
use std::mem::size_of;
println!("{}", size_of::<RobinHashTable<1024>>());
println!("{}", size_of::<RobinHashTable<65536>>());
}
39 changes: 39 additions & 0 deletions tests/crashes/105488.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//@ known-bug: #105488

pub trait MyFnOnce {
type Output;

fn call_my_fn_once(self) -> Self::Output;
}

pub struct WrapFnOnce<F>(F);

impl<F: FnOnce() -> D, D: MyFnOnce> MyFnOnce for WrapFnOnce<F> {
type Output = D::Output;

fn call_my_fn_once(self) -> Self::Output {
D::call_my_fn_once(self.0())
}
}

impl<F: FnOnce() -> D, D: MyFnOnce> MyFnOnce for F {
type Output = D::Output;

fn call_my_fn_once(self) -> Self::Output {
D::call_my_fn_once(self())
}
}

pub fn my_fn_1() -> impl MyFnOnce {
my_fn_2
}

pub fn my_fn_2() -> impl MyFnOnce {
WrapFnOnce(my_fn_1)
}

fn main() {
let v = my_fn_1();

let _ = v.call_my_fn_once();
}
9 changes: 9 additions & 0 deletions tests/crashes/108814.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//@ known-bug: #108814

#![feature(non_lifetime_binders)]

fn take(_: impl for<T> FnOnce(T) -> T) {}

fn main() {
take(|x| x)
}
9 changes: 9 additions & 0 deletions tests/crashes/109681.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//@ known-bug: #109681

#![crate_type="lib"]
#![feature(linkage)]

#[linkage = "common"]
pub static TEST3: bool = true;

fn main() {}
15 changes: 15 additions & 0 deletions tests/crashes/110378.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//@ known-bug: #110378
// ignore-tidy-linelength

#![feature(generic_const_exprs)]

fn foo<const L: usize>(_a: [u8; L], _b: [u8; L]) -> [u8; L + 1] {
[0_u8; L + 1]
}

fn main() {
let baz = [[0_u8; 1]; 8];

let _: [u8; 4] = foo(foo(foo(baz[0], baz[1]), foo(baz[2], baz[3])), foo(foo(baz[4], baz[5]), foo(baz[6], baz[7])));
//let _: [u8; 3] = foo(foo(baz[0], baz[1]), foo(baz[2], baz[3]));
}
28 changes: 28 additions & 0 deletions tests/crashes/110630.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//@ known-bug: #110630

#![feature(generic_const_exprs)]

use std::ops::Mul;

pub trait Indices<const N: usize> {
const NUM_ELEMS: usize = I::NUM_ELEMS * N;
}

pub trait Concat<J> {
type Output;
}

pub struct Tensor<I: Indices<N>, const N: usize>
where
[u8; I::NUM_ELEMS]: Sized, {}

impl<I: Indices<N>, J: Indices<N>, const N: usize> Mul<Tensor<J, N>> for Tensor<I, N>
where
I: Concat<T>,
<I as Concat<J>>::Output: Indices<N>,
[u8; I::NUM_ELEMS]: Sized,
[u8; J::NUM_ELEMS]: Sized,
[u8; <I as Concat<J>>::Output::NUM_ELEMS]: Sized,
{
type Output = Tensor<<I as Concat<J>>::Output, N>;
}
12 changes: 12 additions & 0 deletions tests/crashes/111742.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//@ known-bug: #111742
// ignore-tidy-linelength

#![allow(incomplete_features)]
#![feature(generic_const_exprs)]

const CONST: u32 = 0;
struct Test<const N: u32, const M: u32 = { CONST/* Must be a const and not a Literal */ }> where [(); N as usize]: , ([u32; N as usize]);

fn main() {
let _: Test<1>;
}
19 changes: 19 additions & 0 deletions tests/crashes/112201.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//@ known-bug: #112201

pub fn compose(
f1: impl FnOnce(f64) -> f64 + Clone,
f2: impl FnOnce(f64) -> f64 + Clone,
) -> impl FnOnce(f64) -> f64 + Clone {
move |x| f1(f2(x))
}

fn repeat_helper(
f: impl FnOnce(f64) -> f64 + Clone,
res: impl FnOnce(f64) -> f64 + Clone,
times: usize,
) -> impl FnOnce(f64) -> f64 + Clone {
return res;
repeat_helper(f.clone(), compose(f, res), times - 1)
}

fn main() {}
15 changes: 15 additions & 0 deletions tests/crashes/113280.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//@ known-bug: #113280

#![feature(dyn_star, pointer_like_trait)]
#![allow(incomplete_features)]

use std::fmt::Debug;
use std::marker::PointerLike;

fn make_dyn_star<'a>(t: impl PointerLike + Debug + 'a) -> dyn* Debug + 'a {
f32::from_bits(0x1) as f64
}

fn main() {
println!("{:?}", make_dyn_star(Box::new(1i32)));
}
7 changes: 7 additions & 0 deletions tests/crashes/113379.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//@ known-bug: #113379

async fn f999() -> Vec<usize> {
'b: {
continue 'b;
}
}
2 changes: 1 addition & 1 deletion tests/crashes/122909.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ compile-flags: -Zpolymorphize=on -Zinline-mir=yes
//@ known-bug: #12345
//@ known-bug: #122909


use std::sync::{Arc, Context, Weak};
Expand Down
6 changes: 6 additions & 0 deletions tests/crashes/34127.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//@ compile-flags: -g -Copt-level=0
//@ known-bug: #34127

pub fn main() {
let _a = [(); 1 << 63];
}
21 changes: 21 additions & 0 deletions tests/crashes/54888.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//@ known-bug: #54888

#![feature(unsize, coerce_unsized)]

use std::{
ops::CoerceUnsized,
marker::Unsize,
};

#[repr(C)]
struct Ptr<T: ?Sized>(Box<T>);

impl<T: ?Sized, U: ?Sized> CoerceUnsized<Ptr<U>> for Ptr<T>
where
T: Unsize<U>,
{}


fn main() {
let foo = Ptr(Box::new(5)) as Ptr<dyn std::any::Any>;
}
11 changes: 11 additions & 0 deletions tests/crashes/57276.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//@ known-bug: #57276

#![feature(arbitrary_self_types, dispatch_from_dyn)]

use std::ops::{Deref, DispatchFromDyn};

trait Trait<T: Deref<Target = Self> + DispatchFromDyn<T>> {
fn foo(self: T) -> dyn Trait<T>;
}

fn main() {}
Loading

0 comments on commit da8597f

Please sign in to comment.