Skip to content

Commit bf750f5

Browse files
committed
Auto merge of rust-lang#126869 - matthiaskrgr:kaboom, r=jieyouxu
crashes: add more tests
2 parents ba1d7f4 + c59e7fd commit bf750f5

File tree

9 files changed

+142
-0
lines changed

9 files changed

+142
-0
lines changed

tests/crashes/126646.rs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//@ known-bug: rust-lang/rust#126646
2+
mod foo {
3+
pub trait Callable {
4+
type Output;
5+
fn call() -> Self::Output;
6+
}
7+
8+
impl<'a, V: ?Sized> Callable for &'a () {
9+
type Output = ();
10+
}
11+
}
12+
use foo::*;
13+
14+
fn test<'a>() -> impl Sized {
15+
<&'a () as Callable>::call()
16+
}
17+
18+
fn main() {}

tests/crashes/126648.rs

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

tests/crashes/126666.rs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//@ known-bug: rust-lang/rust#126666
2+
#![feature(const_mut_refs)]
3+
#![feature(const_refs_to_static)]
4+
#![feature(object_safe_for_dispatch)]
5+
6+
struct Meh {
7+
x: &'static dyn UnsafeCell,
8+
}
9+
10+
const MUH: Meh = Meh {
11+
x: &mut *(&READONLY as *const _ as *mut _),
12+
};
13+
14+
static READONLY: i32 = 0;
15+
16+
trait UnsafeCell<'a> {}
17+
18+
pub fn main() {}

tests/crashes/126667.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//@ known-bug: rust-lang/rust#126667
2+
#![warn(rust_2021_compatibility)]
3+
4+
trait Static<'a> {}
5+
6+
struct Foo((u32, u32));
7+
8+
fn main() {
9+
type T = impl Static;
10+
let foo: T = Foo((1u32, 2u32));
11+
let x = move || {
12+
let Foo((a, b)) = foo;
13+
};
14+
}

tests/crashes/126680.rs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//@ known-bug: rust-lang/rust#126680
2+
//@ compile-flags: -Zvalidate-mir
3+
#![feature(type_alias_impl_trait)]
4+
type Bar = impl std::fmt::Display;
5+
6+
use std::path::Path;
7+
8+
struct A {
9+
pub func: fn(check: Bar, b: Option<&Path>),
10+
}
11+
const MY_A: A = A {
12+
func: |check, b| {
13+
if check {
14+
()
15+
} else if let Some(_) = b.and_then(|p| p.parent()) {
16+
()
17+
}
18+
},
19+
};
20+
21+
fn main() {}

tests/crashes/126696.rs

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//@ known-bug: rust-lang/rust#126696
2+
#![feature(generic_const_exprs)]
3+
#![allow(incomplete_features)]
4+
5+
fn can_double<const N: usize>(x: [(); N])
6+
where
7+
[(); N * 2]:,
8+
{
9+
x[0];
10+
unimplemented!()
11+
}
12+
13+
fn foo<const N: usize>()
14+
where
15+
[(); (N + 1) * 2]:,
16+
{
17+
can_double([(); { N + 1 }]);
18+
// Adding an explicit constant generic causes the ICE to go away
19+
// can_double::<{N + 1}>([(); { N + 1 }]);
20+
}
21+
22+
fn main() {
23+
foo::<1>();
24+
}

tests/crashes/126725.rs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//@ known-bug: rust-lang/rust#126725
2+
trait Foo {
3+
fn foo<'a>(&'a self) -> <&'a impl Sized as Bar>::Output;
4+
}
5+
6+
trait Bar {
7+
type Output;
8+
}
9+
10+
struct X(i32);
11+
12+
impl<'a> Bar for &'a X {
13+
type Output = &'a i32;
14+
}
15+
16+
impl Foo for X {
17+
fn foo<'a>(&'a self) -> <&'a Self as Bar>::Output {
18+
&self.0
19+
}
20+
}

tests/crashes/126744.rs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//@ known-bug: rust-lang/rust#126744
2+
struct X {,}
3+
4+
fn main() {
5+
|| {
6+
if let X { x: 1,} = (X {}) {}
7+
};
8+
}

tests/crashes/126850.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//@ known-bug: rust-lang/rust#126850
2+
fn bug<T>() -> impl Iterator<
3+
Item = [(); {
4+
|found: &String| Some(false);
5+
4
6+
}],
7+
> {
8+
std::iter::empty()
9+
}
10+
11+
fn main() {}

0 commit comments

Comments
 (0)