diff --git a/tests/crashes/100618.rs b/tests/crashes/100618.rs new file mode 100644 index 00000000000..911c4098bad --- /dev/null +++ b/tests/crashes/100618.rs @@ -0,0 +1,12 @@ +//@ known-bug: #100618 +//@ compile-flags: -Cdebuginfo=2 + +//@ only-x86_64 +enum Foo<T: 'static> { + Value(T), + Recursive(&'static Foo<Option<T>>), +} + +fn main() { + let _x = Foo::Value(()); +} diff --git a/tests/crashes/105299.rs b/tests/crashes/105299.rs new file mode 100644 index 00000000000..8e3aafa47bc --- /dev/null +++ b/tests/crashes/105299.rs @@ -0,0 +1,19 @@ +//@ known-bug: #105299 + +pub trait Foo: Clone {} + +pub struct Bar<'a, T: Clone> { + pub cow: std::borrow::Cow<'a, [T]>, + + pub THIS_CAUSES_ICE: (), // #1 +} + +impl<T> Bar<'_, T> +where + T: Clone, + [T]: Foo, +{ + pub fn MOVES_SELF(self) {} // #2 +} + +pub fn main() {} diff --git a/tests/crashes/107362.rs b/tests/crashes/107362.rs new file mode 100644 index 00000000000..8d55d611eb1 --- /dev/null +++ b/tests/crashes/107362.rs @@ -0,0 +1,43 @@ +//@ known-bug: #107362 +//@ compile-flags: -Cdebuginfo=2 + +pub trait Functor +{ + type With<T>: Functor; +} + +pub struct IdFunctor<T>(T); +impl<T> Functor for IdFunctor<T> { + type With<T2> = IdFunctor<T2>; +} + +impl<T> Functor for Vec<T> { + type With<T2> = Vec<T2> ; +} + + +pub struct Compose<F1, F2, T>(F1::With<F2::With<T>>) +where + F1: Functor + ?Sized, + F2: Functor + ?Sized; + +impl<F1, F2, T> Functor for Compose<F1, F2, T> +where + F1: Functor + ?Sized, + F2: Functor + ?Sized +{ + type With<T2> = F1::With<F2::With<T2>> ; +} + +pub enum Value<F> +where + F: Functor + ?Sized, +{ + SignedInt(*mut F::With<i64>), + Array(*mut Value<Compose<F, Vec<()>, ()>>), + +} + +fn main() { + let x: Value<IdFunctor<()>> = Value::SignedInt(&mut IdFunctor(1)); +} diff --git a/tests/crashes/108499.rs b/tests/crashes/108499.rs new file mode 100644 index 00000000000..4a0638cd59a --- /dev/null +++ b/tests/crashes/108499.rs @@ -0,0 +1,44 @@ +//@ known-bug: #108499 + +// at lower recursion limits the recursion limit is reached before the bug happens +#![recursion_limit = "2000"] + +// this will try to calculate 3↑↑3=3^(3^3) +type Test = <() as Op<((), ()), [[[(); 0]; 0]; 0], [[[(); 0]; 0]; 0], + [[[[(); 0]; 0]; 0]; 0]>>::Result; + +use std::default::Default; + +fn main() { + // force the compiler to actually evaluate `Test` + println!("{}", Test::default()); +} + +trait Op<X, A, B, C> { + type Result; +} + +// this recursive function defines the hyperoperation sequence, +// a canonical example of the type of recursion which produces the issue +// the problem seems to be caused by having two recursive calls, the second +// of which depending on the first +impl< + X: Op<(X, Y), A, [B; 0], [C; 0]>, + Y: Op<(X, Y), A, X::Result, C>, + A, B, C, +> Op<(X, Y), A, [[B; 0]; 0], [C; 0]> for () { + type Result = Y::Result; +} + +// base cases +impl<X, A, B> Op<X, A, B, ()> for () { + type Result = [B; 0]; +} + +impl<X, A> Op<X, A, [(); 0], [(); 0]> for () { + type Result = [A; 0]; +} + +impl<X, A, C> Op<X, A, [(); 0], [[C; 0]; 0]> for () { + type Result = A; +} diff --git a/tests/crashes/114920.rs b/tests/crashes/114920.rs new file mode 100644 index 00000000000..9aa7598e10f --- /dev/null +++ b/tests/crashes/114920.rs @@ -0,0 +1,2 @@ +//@ known-bug: #114920 +#![core::prelude::v1::test] diff --git a/tests/crashes/118185-2.rs b/tests/crashes/118185-2.rs new file mode 100644 index 00000000000..c3a29c3a3f5 --- /dev/null +++ b/tests/crashes/118185-2.rs @@ -0,0 +1,26 @@ +//@ known-bug: #118185 + +fn main() { + let target: Target = create_target(); + target.get(0); // correct arguments work + target.get(10.0); // CRASH HERE +} + +// must be generic +fn create_target<T>() -> T { + unimplemented!() +} + +// unimplemented trait, but contains function with the same name +pub trait RandomTrait { + fn get(&mut self); // but less arguments +} + +struct Target; + +impl Target { + // correct function with arguments + pub fn get(&self, data: i32) { + unimplemented!() + } +} diff --git a/tests/crashes/118545.rs b/tests/crashes/118545.rs new file mode 100644 index 00000000000..1d4bb848bf0 --- /dev/null +++ b/tests/crashes/118545.rs @@ -0,0 +1,8 @@ +//@ known-bug: #118545 +#![feature(generic_const_exprs)] + +struct Checked<const F: fn()>; + +fn foo() {} +const _: Checked<foo> = Checked::<foo>; +pub fn main() {} diff --git a/tests/crashes/118590.rs b/tests/crashes/118590.rs new file mode 100644 index 00000000000..829c16582dc --- /dev/null +++ b/tests/crashes/118590.rs @@ -0,0 +1,11 @@ +//@ known-bug: #118590 + +fn main() { + recurse(std::iter::empty::<()>()) +} + +fn recurse(nums: impl Iterator) { + if true { return } + + recurse(nums.skip(42).peekable()) +} diff --git a/tests/crashes/119381.rs b/tests/crashes/119381.rs new file mode 100644 index 00000000000..51d1d084ba2 --- /dev/null +++ b/tests/crashes/119381.rs @@ -0,0 +1,6 @@ +//@ known-bug: #119381 + +#![feature(with_negative_coherence)] +trait Trait {} +impl<const N: u8> Trait for [(); N] {} +impl<const N: i8> Trait for [(); N] {} diff --git a/tests/crashes/120033.rs b/tests/crashes/120033.rs new file mode 100644 index 00000000000..f1502978dc5 --- /dev/null +++ b/tests/crashes/120033.rs @@ -0,0 +1,14 @@ +//@ known-bug: #120033 +#![feature(non_lifetime_binders)] + +pub trait Foo<T: ?Sized> { + type Bar<K: ?Sized>; +} + +pub struct Bar<T: ?AutoTrait> {} + +pub fn f<T1, T2>() +where + T1: for<T> Foo<usize, Bar = Bar<T>>, + T2: for<L, T> Foo<usize, Bar<T> = T1::Bar<T>>, +{} diff --git a/tests/crashes/120254.rs b/tests/crashes/120254.rs new file mode 100644 index 00000000000..ea68523820e --- /dev/null +++ b/tests/crashes/120254.rs @@ -0,0 +1,24 @@ +//@ known-bug: #120254 + +trait Dbg {} + +struct Foo<I, E> { + input: I, + errors: E, +} + +trait Bar: Offset<<Self as Bar>::Checkpoint> { + type Checkpoint; +} + +impl<I: Bar, E: Dbg> Bar for Foo<I, E> { + type Checkpoint = I::Checkpoint; +} + +trait Offset<Start = Self> {} + +impl<I: Bar, E: Dbg> Offset<<Foo<I, E> as Bar>::Checkpoint> for Foo<I, E> {} + +impl<I: Bar, E> Foo<I, E> { + fn record_err(self, _: <Self as Bar>::Checkpoint) -> () {} +} diff --git a/tests/crashes/121363.rs b/tests/crashes/121363.rs new file mode 100644 index 00000000000..2a5b6274496 --- /dev/null +++ b/tests/crashes/121363.rs @@ -0,0 +1,9 @@ +//@ known-bug: #121363 +//@ compile-flags: -Zmir-opt-level=5 --crate-type lib + +#![feature(trivial_bounds)] + +#[derive(Debug)] +struct TwoStrs(str, str) +where + str: Sized; diff --git a/tests/crashes/121538.rs b/tests/crashes/121538.rs new file mode 100644 index 00000000000..f18bad84b57 --- /dev/null +++ b/tests/crashes/121538.rs @@ -0,0 +1,30 @@ +//@ known-bug: #121538 +//@ compile-flags: -Cdebuginfo=2 + +use std::marker::PhantomData; + +struct Digit<T> { + elem: T +} + +struct Node<T:'static> { m: PhantomData<&'static T> } + +enum FingerTree<T:'static> { + Single(T), + + Deep( + Digit<T>, + Node<FingerTree<Node<T>>>, + ) +} + +enum Wrapper<T:'static> { + Simple, + Other(FingerTree<T>), +} + +fn main() { + let w = + Some(Wrapper::Simple::<u32>); + +} diff --git a/tests/crashes/122259.rs b/tests/crashes/122259.rs new file mode 100644 index 00000000000..5ac8063f0f3 --- /dev/null +++ b/tests/crashes/122259.rs @@ -0,0 +1,12 @@ +//@ known-bug: #122259 + +#![feature(unsized_fn_params)] + +#[derive(Copy, Clone)] +struct Target(str); + +fn w(t: &Target) { + x(*t); +} + +fn x(t: Target) {} diff --git a/tests/crashes/122630.rs b/tests/crashes/122630.rs new file mode 100644 index 00000000000..e66624431c5 --- /dev/null +++ b/tests/crashes/122630.rs @@ -0,0 +1,22 @@ +//@ known-bug: #122630 +//@ compile-flags: -Zvalidate-mir + +use std::ops::Coroutine; + +const FOO_SIZE: usize = 1024; +struct Foo([u8; FOO_SIZE]); + +impl Drop for Foo { + fn move_before_yield_with_noop() -> impl Coroutine<Yield = ()> {} +} + +fn overlap_move_points() -> impl Coroutine<Yield = ()> { + static || { + let first = Foo([0; FOO_SIZE]); + yield; + let second = first; + yield; + let second = first; + yield; + } +} diff --git a/tests/crashes/97006.rs b/tests/crashes/97006.rs new file mode 100644 index 00000000000..c8dfa52ebee --- /dev/null +++ b/tests/crashes/97006.rs @@ -0,0 +1,15 @@ +//@ known-bug: #97006 +//@ compile-flags: -Zunpretty=hir + +#![allow(unused)] + +macro_rules! m { + ($attr_path: path) => { + #[$attr_path] + fn f() {} + } +} + +m!(inline<u8>); //~ ERROR: unexpected generic arguments in path + +fn main() {}