Skip to content

Commit 7cb7337

Browse files
authored
Rollup merge of #124408 - matthiaskrgr:loltest, r=jieyouxu
crashes: add more tests
2 parents 608f71e + 60c0fa1 commit 7cb7337

File tree

9 files changed

+102
-0
lines changed

9 files changed

+102
-0
lines changed

tests/crashes/124262.rs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//@ known-bug: #124262
2+
//@ edition:2021
3+
4+
struct Foo(<&[fn()] as ::core::ops::Deref>::Target);
5+
const _: *const Foo = 0 as _;

tests/crashes/124340.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//@ known-bug: #124340
2+
#![feature(anonymous_lifetime_in_impl_trait)]
3+
4+
trait Producer {
5+
type Output;
6+
fn produce(self) -> Self::Output;
7+
}
8+
9+
trait SomeTrait<'a> {}
10+
11+
fn force_same_lifetime<'a>(_x: &'a i32, _y: impl SomeTrait<'a>) {
12+
unimplemented!()
13+
}
14+
15+
fn foo<'a>(s: &'a i32, producer: impl Producer<Output: SomeTrait<'_>>) {
16+
force_same_lifetime(s, producer.produce());
17+
}

tests/crashes/124342.rs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//@ known-bug: #124342
2+
trait Trait2 : Trait {
3+
reuse <() as Trait>::async {
4+
(async || {}).await;
5+
};
6+
}

tests/crashes/124347.rs

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//@ known-bug: #124347
2+
trait Trait: ToReuse {
3+
reuse Trait::lolno { &self.0 };
4+
}

tests/crashes/124348.rs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//@ known-bug: #124348
2+
enum Eek {
3+
TheConst,
4+
UnusedByTheConst(Sum),
5+
}
6+
7+
const EEK_ZERO: &[Eek] = &[];

tests/crashes/124350.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//@ known-bug: #124350
2+
3+
struct Node<const D: usize> {}
4+
5+
impl Node<D>
6+
where
7+
SmallVec<{ D * 2 }>:,
8+
{
9+
fn new() -> Self {
10+
let mut node = Node::new();
11+
(&a, 0)();
12+
13+
node
14+
}
15+
}
16+
17+
struct SmallVec<T1, T2> {}

tests/crashes/124352.rs

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//@ known-bug: #124352
2+
#![rustc_never_type_options(: Unsize<U> = "hi")]
3+
4+
fn main() {}

tests/crashes/124375.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//@ known-bug: #124375
2+
//@ compile-flags: -Zmir-opt-level=0
3+
//@ only-x86_64
4+
#![crate_type = "lib"]
5+
#![feature(naked_functions)]
6+
use std::arch::asm;
7+
8+
#[naked]
9+
pub unsafe extern "C" fn naked_with_args_and_return(a: isize, b: isize) -> isize {
10+
asm!("lea rax, [rdi + rsi]", "ret", options(noreturn));
11+
}

tests/crashes/92470.rs

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//@ known-bug: #92470
2+
fn main() {
3+
encode(&mut EncoderImpl);
4+
}
5+
6+
pub trait Encoder {
7+
type W;
8+
9+
fn writer(&self) -> Self::W;
10+
}
11+
12+
fn encode<E: Encoder>(mut encoder: E) {
13+
encoder.writer();
14+
encode(&mut encoder);
15+
}
16+
17+
struct EncoderImpl;
18+
19+
impl Encoder for EncoderImpl {
20+
type W = ();
21+
22+
fn writer(&self) {}
23+
}
24+
25+
impl<'a, T: Encoder> Encoder for &'a mut T {
26+
type W = T::W;
27+
28+
fn writer(&self) -> Self::W {
29+
panic!()
30+
}
31+
}

0 commit comments

Comments
 (0)