Skip to content

Commit 06335c6

Browse files
committed
crashes: add even more tests?!?
1 parent 468f115 commit 06335c6

27 files changed

+723
-0
lines changed

Diff for: tests/crashes/112623.rs

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//@ known-bug: #112623
2+
3+
#![feature(const_trait_impl, effects)]
4+
5+
#[const_trait]
6+
trait Value {
7+
fn value() -> u32;
8+
}
9+
10+
const fn get_value<T: ~const Value>() -> u32 {
11+
T::value()
12+
}
13+
14+
struct FortyTwo;
15+
16+
impl const Value for FortyTwo {
17+
fn value() -> i64 {
18+
42
19+
}
20+
}
21+
22+
const FORTY_TWO: u32 = get_value::<FortyTwo>();
23+
24+
fn main() {
25+
assert_eq!(FORTY_TWO, 42);
26+
}

Diff for: tests/crashes/114198-2.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//@ known-bug: #114198
2+
//@ compile-flags: -Zprint-mono-items=eager
3+
4+
impl Trait for <Ty as Owner>::Struct {}
5+
trait Trait {
6+
fn test(&self) {}
7+
}
8+
9+
enum Ty {}
10+
trait Owner { type Struct: ?Sized; }
11+
impl Owner for Ty {
12+
type Struct = dyn Trait + Send;
13+
}
14+
15+
fn main() {}

Diff for: tests/crashes/114198.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//@ known-bug: #114198
2+
//@ compile-flags: -Zprint-mono-items=eager
3+
4+
#![feature(lazy_type_alias)]
5+
6+
impl Trait for Struct {}
7+
trait Trait {
8+
fn test(&self) {}
9+
}
10+
11+
type Struct = dyn Trait + Send;
12+
13+
fn main() {}

Diff for: tests/crashes/118185.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+
}

Diff for: tests/crashes/120421.rs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//@ known-bug: #120421
2+
//@ compile-flags: -Zlint-mir
3+
4+
#![feature(never_patterns)]
5+
6+
enum Void {}
7+
8+
fn main() {
9+
let res_void: Result<bool, Void> = Ok(true);
10+
11+
for (Ok(mut _x) | Err(!)) in [res_void] {}
12+
}

Diff for: tests/crashes/120792.rs

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//@ known-bug: #120792
2+
//@ compile-flags: -Zpolymorphize=on -Zinline-mir=yes
3+
4+
impl Trait<()> for () {
5+
fn foo<'a, K>(self, _: (), _: K) {
6+
todo!();
7+
}
8+
}
9+
10+
trait Foo<T> {}
11+
12+
impl<F, T> Foo<T> for F {
13+
fn main() {
14+
().foo((), ());
15+
}
16+
}
17+
18+
trait Trait<T> {
19+
fn foo<'a, K>(self, _: T, _: K)
20+
where
21+
T: 'a,
22+
K: 'a;
23+
}
24+
25+
pub fn main() {}

Diff for: tests/crashes/120811.rs

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//@ known-bug: #120811
2+
3+
trait Container {
4+
type Item<'a>;
5+
}
6+
impl Container for () {
7+
type Item<'a> = ();
8+
}
9+
struct Exchange<C, F> {
10+
_marker: std::marker::PhantomData<(C, F)>,
11+
}
12+
fn exchange<C, F>(_: F) -> Exchange<C, F>
13+
where
14+
C: Container,
15+
for<'a> F: FnMut(&C::Item<'a>),
16+
{
17+
unimplemented!()
18+
}
19+
trait Parallelization<C> {}
20+
impl<C, F> Parallelization<C> for Exchange<C, F> {}
21+
fn unary_frontier<P: Parallelization<()>>(_: P) {}
22+
fn main() {
23+
let exchange = exchange(|_| ());
24+
let _ = || {
25+
unary_frontier(exchange);
26+
};
27+
}

Diff for: tests/crashes/121063.rs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//@ known-bug: #121063
2+
//@ compile-flags: -Zpolymorphize=on --edition=2021 -Zinline-mir=yes
3+
4+
use std::{
5+
fmt, ops,
6+
path::{Component, Path, PathBuf},
7+
};
8+
9+
pub struct AbsPathBuf(PathBuf);
10+
11+
impl TryFrom<PathBuf> for AbsPathBuf {
12+
type Error = PathBuf;
13+
fn try_from(path: impl AsRef<Path>) -> Result<AbsPathBuf, PathBuf> {}
14+
}
15+
16+
impl TryFrom<&str> for AbsPathBuf {
17+
fn try_from(path: &str) -> Result<AbsPathBuf, PathBuf> {
18+
AbsPathBuf::try_from(PathBuf::from(path))
19+
}
20+
}

Diff for: tests/crashes/121127.rs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//@ known-bug: #121127
2+
//@ compile-flags: -Zpolymorphize=on -Zinline-mir=yes
3+
4+
#![feature(specialization)]
5+
6+
pub trait Foo {
7+
fn abc() -> u32;
8+
}
9+
10+
pub trait Marker {}
11+
12+
impl<T> Foo for T {
13+
default fn abc(f: fn(&T), t: &T) -> u32 {
14+
16
15+
}
16+
}
17+
18+
impl<T: Marker> Foo for T {
19+
fn def() -> u32 {
20+
Self::abc()
21+
}
22+
}

Diff for: tests/crashes/123456.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//@ known-bug: #123456
2+
3+
trait Project {
4+
const SELF: Self;
5+
}
6+
7+
fn take1(
8+
_: Project<
9+
SELF = {
10+
j2.join().unwrap();
11+
},
12+
>,
13+
) {
14+
}
15+
16+
pub fn main() {}

Diff for: tests/crashes/123461.rs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//@ known-bug: #123461
2+
3+
fn main() {
4+
let _: [_; unsafe { std::mem::transmute(|o_b: Option<_>| {}) }];
5+
}

0 commit comments

Comments
 (0)