Skip to content

Commit b015f61

Browse files
committed
add more known-crashes tests
1 parent e0586a6 commit b015f61

File tree

9 files changed

+122
-0
lines changed

9 files changed

+122
-0
lines changed

tests/crashes/103708.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//@ known-bug: #103708
2+
#![feature(min_specialization)]
3+
4+
trait MySpecTrait {
5+
fn f();
6+
}
7+
8+
impl<'a, T: ?Sized> MySpecTrait for T {
9+
default fn f() {}
10+
}
11+
12+
impl<'a, T: ?Sized> MySpecTrait for &'a T {
13+
fn f() {}
14+
}
15+
16+
fn main() {}

tests/crashes/104685.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//@ known-bug: #104685
2+
//@ compile-flags: -Zextra-const-ub-checks
3+
#![feature(extern_types)]
4+
5+
extern {
6+
pub type ExternType;
7+
}
8+
9+
extern "C" {
10+
pub static EXTERN: ExternType;
11+
}
12+
13+
pub static EMPTY: () = unsafe { &EXTERN; };
14+
15+
fn main() {}

tests/crashes/105249.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//@ known-bug: #105249
2+
//@ compile-flags: -Zpolymorphize=on
3+
4+
trait Foo<T> {
5+
fn print<'a>(&'a self) where T: 'a { println!("foo"); }
6+
}
7+
8+
impl<'a> Foo<&'a ()> for () { }
9+
10+
trait Bar: for<'a> Foo<&'a ()> { }
11+
12+
impl Bar for () {}
13+
14+
fn main() {
15+
(&() as &dyn Bar).print(); // Segfault
16+
}

tests/crashes/115994.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//@ known-bug: #115994
2+
//@ compile-flags: -Cdebuginfo=2 --crate-type lib
3+
4+
// To prevent "overflow while adding drop-check rules".
5+
use std::mem::ManuallyDrop;
6+
7+
pub enum Foo<U> {
8+
Leaf(U),
9+
10+
Branch(BoxedFoo<BoxedFoo<U>>),
11+
}
12+
13+
pub type BoxedFoo<U> = ManuallyDrop<Box<Foo<U>>>;
14+
15+
pub fn test() -> Foo<usize> {
16+
todo!()
17+
}

tests/crashes/116721.rs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//@ known-bug: #116721
2+
//@ compile-flags: -Zmir-opt-level=3 --emit=mir
3+
fn hey<T>(it: &[T])
4+
where
5+
[T]: Clone,
6+
{
7+
}
8+
9+
fn main() {}

tests/crashes/118244.rs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//@ known-bug: #118244
2+
//@ compile-flags: -Cdebuginfo=2
3+
4+
#![allow(incomplete_features)]
5+
#![feature(generic_const_exprs)]
6+
struct Inner<const N: usize, const M: usize>;
7+
impl<const N: usize, const M: usize> Inner<N, M> where [(); N + M]: {
8+
fn i() -> Self {
9+
Self
10+
}
11+
}
12+
13+
struct Outer<const A: usize, const B: usize>(Inner<A, { B * 2 }>) where [(); A + (B * 2)]:;
14+
impl<const A: usize, const B: usize> Outer<A, B> where [(); A + (B * 2)]: {
15+
fn o() -> Self {
16+
Self(Inner::i())
17+
}
18+
}
19+
20+
fn main() {
21+
Outer::<1, 1>::o();
22+
}

tests/crashes/124083.rs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//@ known-bug: #124083
2+
3+
struct Outest(&'a ());
4+
5+
fn make() -> Outest {}
6+
7+
fn main() {
8+
if let Outest("foo") = make() {}
9+
}

tests/crashes/124151.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//@ known-bug: #124151
2+
#![feature(generic_const_exprs)]
3+
4+
use std::ops::Add;
5+
6+
pub struct Dimension;
7+
8+
pub struct Quantity<S, const D: Dimension>(S);
9+
10+
impl<const D: Dimension, LHS, RHS> Add<LHS, D> for Quantity<LHS, { Dimension }> {}
11+
12+
pub fn add<const U: Dimension>(x: Quantity<f32, U>) -> Quantity<f32, U> {
13+
x + y
14+
}

tests/crashes/124164.rs

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//@ known-bug: #124164
2+
static S_COUNT: = std::sync::atomic::AtomicUsize::new(0);
3+
4+
fn main() {}

0 commit comments

Comments
 (0)