Skip to content

Commit 9371859

Browse files
Rollup merge of rust-lang#129135 - matthiaskrgr:ITKEEPSCRASHINGAAAAAAAAHH, r=compiler-errors
crashes: more tests r? ``@jieyouxu``
2 parents ec97c5a + 7d99549 commit 9371859

File tree

9 files changed

+131
-0
lines changed

9 files changed

+131
-0
lines changed

tests/crashes/128695.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//@ known-bug: rust-lang/rust#128695
2+
//@ edition: 2021
3+
4+
use core::pin::{pin, Pin};
5+
6+
fn main() {
7+
let fut = pin!(async {
8+
let async_drop_fut = pin!(core::future::async_drop(async {}));
9+
(async_drop_fut).await;
10+
});
11+
}

tests/crashes/128810.rs

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//@ known-bug: rust-lang/rust#128810
2+
3+
#![feature(fn_delegation)]
4+
5+
use std::marker::PhantomData;
6+
7+
pub struct InvariantRef<'a, T: ?Sized>(&'a T, PhantomData<&'a mut &'a T>);
8+
9+
impl<'a> InvariantRef<'a, ()> {
10+
pub const NEW: Self = InvariantRef::new(&());
11+
}
12+
13+
trait Trait {
14+
fn foo(&self) -> u8 { 0 }
15+
fn bar(&self) -> u8 { 1 }
16+
fn meh(&self) -> u8 { 2 }
17+
}
18+
19+
struct Z(u8);
20+
21+
impl Trait for Z {
22+
reuse <u8 as Trait>::{foo, bar, meh} { &const { InvariantRef::<'a>::NEW } }
23+
}
24+
25+
fn main() { }

tests/crashes/128848.rs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//@ known-bug: rust-lang/rust#128848
2+
3+
fn f<T>(a: T, b: T, c: T) {
4+
f.call_once()
5+
}

tests/crashes/128870.rs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//@ known-bug: rust-lang/rust#128870
2+
//@ compile-flags: -Zvalidate-mir
3+
4+
#[repr(packed)]
5+
#[repr(u32)]
6+
enum E {
7+
A,
8+
B,
9+
C,
10+
}
11+
12+
fn main() {
13+
union InvalidTag {
14+
int: u32,
15+
e: E,
16+
}
17+
let _invalid_tag = InvalidTag { int: 4 };
18+
}

tests/crashes/129075.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//@ known-bug: rust-lang/rust#129075
2+
//@ compile-flags: -Zvalidate-mir -Zinline-mir=yes
3+
4+
struct Foo<T>([T; 2]);
5+
6+
impl<T: Default + Copy> Default for Foo<T> {
7+
fn default(&mut self) -> Self {
8+
Foo([Default::default(); 2])
9+
}
10+
}
11+
12+
fn field_array() {
13+
let a: i32;
14+
let b;
15+
Foo([a, b]) = Default::default();
16+
}

tests/crashes/129095.rs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//@ known-bug: rust-lang/rust#129095
2+
//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir
3+
4+
pub fn function_with_bytes<const BYTES: &'static [u8; 4]>() -> &'static [u8] {
5+
BYTES
6+
}
7+
8+
pub fn main() {
9+
assert_eq!(function_with_bytes::<b"AAAAb">(), &[0x41, 0x41, 0x41, 0x41]);
10+
}

tests/crashes/129099.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//@ known-bug: rust-lang/rust#129099
2+
3+
#![feature(type_alias_impl_trait)]
4+
5+
fn dyn_hoops<T: Sized>() -> dyn for<'a> Iterator<Item = impl Captures<'a>> {
6+
loop {}
7+
}
8+
9+
pub fn main() {
10+
type Opaque = impl Sized;
11+
fn define() -> Opaque {
12+
let x: Opaque = dyn_hoops::<()>(0);
13+
x
14+
}
15+
}

tests/crashes/129109.rs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//@ known-bug: rust-lang/rust#129109
2+
//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir
3+
4+
extern "C" {
5+
pub static mut symbol: [i8];
6+
}
7+
8+
fn main() {
9+
println!("C", unsafe { &symbol });
10+
}

tests/crashes/129127.rs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//@ known-bug: rust-lang/rust#129127
2+
//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir -Zcross-crate-inline-threshold=always
3+
4+
5+
6+
7+
pub struct Rows<'a>();
8+
9+
impl<'a> Iterator for Rows<'a> {
10+
type Item = ();
11+
12+
fn next() -> Option<Self::Item> {
13+
let mut rows = Rows();
14+
rows.map(|row| row).next()
15+
}
16+
}
17+
18+
fn main() {
19+
let mut rows = Rows();
20+
rows.next();
21+
}

0 commit comments

Comments
 (0)