Skip to content

Commit fa0068b

Browse files
committed
Auto merge of rust-lang#124038 - matthiaskrgr:one_or_two_more_tests, r=jieyouxu
crashes: add a couple more ice tests
2 parents e3181b0 + 1d45b7a commit fa0068b

16 files changed

+297
-0
lines changed

tests/crashes/100618.rs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//@ known-bug: #100618
2+
//@ compile-flags: -Cdebuginfo=2
3+
4+
//@ only-x86_64
5+
enum Foo<T: 'static> {
6+
Value(T),
7+
Recursive(&'static Foo<Option<T>>),
8+
}
9+
10+
fn main() {
11+
let _x = Foo::Value(());
12+
}

tests/crashes/105299.rs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//@ known-bug: #105299
2+
3+
pub trait Foo: Clone {}
4+
5+
pub struct Bar<'a, T: Clone> {
6+
pub cow: std::borrow::Cow<'a, [T]>,
7+
8+
pub THIS_CAUSES_ICE: (), // #1
9+
}
10+
11+
impl<T> Bar<'_, T>
12+
where
13+
T: Clone,
14+
[T]: Foo,
15+
{
16+
pub fn MOVES_SELF(self) {} // #2
17+
}
18+
19+
pub fn main() {}

tests/crashes/107362.rs

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
//@ known-bug: #107362
2+
//@ compile-flags: -Cdebuginfo=2
3+
4+
pub trait Functor
5+
{
6+
type With<T>: Functor;
7+
}
8+
9+
pub struct IdFunctor<T>(T);
10+
impl<T> Functor for IdFunctor<T> {
11+
type With<T2> = IdFunctor<T2>;
12+
}
13+
14+
impl<T> Functor for Vec<T> {
15+
type With<T2> = Vec<T2> ;
16+
}
17+
18+
19+
pub struct Compose<F1, F2, T>(F1::With<F2::With<T>>)
20+
where
21+
F1: Functor + ?Sized,
22+
F2: Functor + ?Sized;
23+
24+
impl<F1, F2, T> Functor for Compose<F1, F2, T>
25+
where
26+
F1: Functor + ?Sized,
27+
F2: Functor + ?Sized
28+
{
29+
type With<T2> = F1::With<F2::With<T2>> ;
30+
}
31+
32+
pub enum Value<F>
33+
where
34+
F: Functor + ?Sized,
35+
{
36+
SignedInt(*mut F::With<i64>),
37+
Array(*mut Value<Compose<F, Vec<()>, ()>>),
38+
39+
}
40+
41+
fn main() {
42+
let x: Value<IdFunctor<()>> = Value::SignedInt(&mut IdFunctor(1));
43+
}

tests/crashes/108499.rs

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
//@ known-bug: #108499
2+
3+
// at lower recursion limits the recursion limit is reached before the bug happens
4+
#![recursion_limit = "2000"]
5+
6+
// this will try to calculate 3↑↑3=3^(3^3)
7+
type Test = <() as Op<((), ()), [[[(); 0]; 0]; 0], [[[(); 0]; 0]; 0],
8+
[[[[(); 0]; 0]; 0]; 0]>>::Result;
9+
10+
use std::default::Default;
11+
12+
fn main() {
13+
// force the compiler to actually evaluate `Test`
14+
println!("{}", Test::default());
15+
}
16+
17+
trait Op<X, A, B, C> {
18+
type Result;
19+
}
20+
21+
// this recursive function defines the hyperoperation sequence,
22+
// a canonical example of the type of recursion which produces the issue
23+
// the problem seems to be caused by having two recursive calls, the second
24+
// of which depending on the first
25+
impl<
26+
X: Op<(X, Y), A, [B; 0], [C; 0]>,
27+
Y: Op<(X, Y), A, X::Result, C>,
28+
A, B, C,
29+
> Op<(X, Y), A, [[B; 0]; 0], [C; 0]> for () {
30+
type Result = Y::Result;
31+
}
32+
33+
// base cases
34+
impl<X, A, B> Op<X, A, B, ()> for () {
35+
type Result = [B; 0];
36+
}
37+
38+
impl<X, A> Op<X, A, [(); 0], [(); 0]> for () {
39+
type Result = [A; 0];
40+
}
41+
42+
impl<X, A, C> Op<X, A, [(); 0], [[C; 0]; 0]> for () {
43+
type Result = A;
44+
}

tests/crashes/114920.rs

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
//@ known-bug: #114920
2+
#![core::prelude::v1::test]

tests/crashes/118185-2.rs

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//@ known-bug: #118185
2+
3+
fn main() {
4+
let target: Target = create_target();
5+
target.get(0); // correct arguments work
6+
target.get(10.0); // CRASH HERE
7+
}
8+
9+
// must be generic
10+
fn create_target<T>() -> T {
11+
unimplemented!()
12+
}
13+
14+
// unimplemented trait, but contains function with the same name
15+
pub trait RandomTrait {
16+
fn get(&mut self); // but less arguments
17+
}
18+
19+
struct Target;
20+
21+
impl Target {
22+
// correct function with arguments
23+
pub fn get(&self, data: i32) {
24+
unimplemented!()
25+
}
26+
}

tests/crashes/118545.rs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//@ known-bug: #118545
2+
#![feature(generic_const_exprs)]
3+
4+
struct Checked<const F: fn()>;
5+
6+
fn foo() {}
7+
const _: Checked<foo> = Checked::<foo>;
8+
pub fn main() {}

tests/crashes/118590.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//@ known-bug: #118590
2+
3+
fn main() {
4+
recurse(std::iter::empty::<()>())
5+
}
6+
7+
fn recurse(nums: impl Iterator) {
8+
if true { return }
9+
10+
recurse(nums.skip(42).peekable())
11+
}

tests/crashes/119381.rs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//@ known-bug: #119381
2+
3+
#![feature(with_negative_coherence)]
4+
trait Trait {}
5+
impl<const N: u8> Trait for [(); N] {}
6+
impl<const N: i8> Trait for [(); N] {}

tests/crashes/120033.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//@ known-bug: #120033
2+
#![feature(non_lifetime_binders)]
3+
4+
pub trait Foo<T: ?Sized> {
5+
type Bar<K: ?Sized>;
6+
}
7+
8+
pub struct Bar<T: ?AutoTrait> {}
9+
10+
pub fn f<T1, T2>()
11+
where
12+
T1: for<T> Foo<usize, Bar = Bar<T>>,
13+
T2: for<L, T> Foo<usize, Bar<T> = T1::Bar<T>>,
14+
{}

tests/crashes/120254.rs

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//@ known-bug: #120254
2+
3+
trait Dbg {}
4+
5+
struct Foo<I, E> {
6+
input: I,
7+
errors: E,
8+
}
9+
10+
trait Bar: Offset<<Self as Bar>::Checkpoint> {
11+
type Checkpoint;
12+
}
13+
14+
impl<I: Bar, E: Dbg> Bar for Foo<I, E> {
15+
type Checkpoint = I::Checkpoint;
16+
}
17+
18+
trait Offset<Start = Self> {}
19+
20+
impl<I: Bar, E: Dbg> Offset<<Foo<I, E> as Bar>::Checkpoint> for Foo<I, E> {}
21+
22+
impl<I: Bar, E> Foo<I, E> {
23+
fn record_err(self, _: <Self as Bar>::Checkpoint) -> () {}
24+
}

tests/crashes/121363.rs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//@ known-bug: #121363
2+
//@ compile-flags: -Zmir-opt-level=5 --crate-type lib
3+
4+
#![feature(trivial_bounds)]
5+
6+
#[derive(Debug)]
7+
struct TwoStrs(str, str)
8+
where
9+
str: Sized;

tests/crashes/121538.rs

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//@ known-bug: #121538
2+
//@ compile-flags: -Cdebuginfo=2
3+
4+
use std::marker::PhantomData;
5+
6+
struct Digit<T> {
7+
elem: T
8+
}
9+
10+
struct Node<T:'static> { m: PhantomData<&'static T> }
11+
12+
enum FingerTree<T:'static> {
13+
Single(T),
14+
15+
Deep(
16+
Digit<T>,
17+
Node<FingerTree<Node<T>>>,
18+
)
19+
}
20+
21+
enum Wrapper<T:'static> {
22+
Simple,
23+
Other(FingerTree<T>),
24+
}
25+
26+
fn main() {
27+
let w =
28+
Some(Wrapper::Simple::<u32>);
29+
30+
}

tests/crashes/122259.rs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//@ known-bug: #122259
2+
3+
#![feature(unsized_fn_params)]
4+
5+
#[derive(Copy, Clone)]
6+
struct Target(str);
7+
8+
fn w(t: &Target) {
9+
x(*t);
10+
}
11+
12+
fn x(t: Target) {}

tests/crashes/122630.rs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//@ known-bug: #122630
2+
//@ compile-flags: -Zvalidate-mir
3+
4+
use std::ops::Coroutine;
5+
6+
const FOO_SIZE: usize = 1024;
7+
struct Foo([u8; FOO_SIZE]);
8+
9+
impl Drop for Foo {
10+
fn move_before_yield_with_noop() -> impl Coroutine<Yield = ()> {}
11+
}
12+
13+
fn overlap_move_points() -> impl Coroutine<Yield = ()> {
14+
static || {
15+
let first = Foo([0; FOO_SIZE]);
16+
yield;
17+
let second = first;
18+
yield;
19+
let second = first;
20+
yield;
21+
}
22+
}

tests/crashes/97006.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//@ known-bug: #97006
2+
//@ compile-flags: -Zunpretty=hir
3+
4+
#![allow(unused)]
5+
6+
macro_rules! m {
7+
($attr_path: path) => {
8+
#[$attr_path]
9+
fn f() {}
10+
}
11+
}
12+
13+
m!(inline<u8>); //~ ERROR: unexpected generic arguments in path
14+
15+
fn main() {}

0 commit comments

Comments
 (0)