Skip to content

Commit 594f983

Browse files
committed
crashes: more tests
1 parent 414da5b commit 594f983

27 files changed

+357
-0
lines changed

tests/crashes/138156.rs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
//@ known-bug: #138156
2+
3+
#![feature(generic_const_exprs)]
4+
5+
#[derive(Default)]
6+
pub struct GenId<const IDX: usize>;
7+
8+
pub trait IndexTrait: Default {
9+
const IDX: usize;
10+
}
11+
pub trait ToplogyIndex {
12+
type Idx: IndexTrait;
13+
}
14+
15+
#[derive(Default)]
16+
pub struct Expression<T: ToplogyIndex> {
17+
pub data: T,
18+
}
19+
20+
fn i<T: ToplogyIndex, const IDX0: usize, const IDX1: usize>(s: Expression<T>) ->
21+
Expression<GenId<{ IDX0 | IDX1 }>>
22+
where
23+
GenId<{ IDX0 | IDX1 }>: ToplogyIndex,
24+
{
25+
Expression::default()
26+
}
27+
28+
pub fn sum<In: ToplogyIndex>(s: Expression<In>) -> Expression<In>
29+
where
30+
[(); In::Idx::IDX]:,
31+
{
32+
s
33+
}
34+
35+
fn param_position<In: ToplogyIndex>(s: Expression<In>)
36+
where
37+
GenId<{ 1 | 2 }>: ToplogyIndex,
38+
{
39+
sum(i::<_, 1, 2>(s));
40+
}
41+
42+
fn main() {}

tests/crashes/138214.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//@ known-bug: #138214
2+
3+
struct Demo<X, Y: A = X, Z = <<Y as A>::U as B>::V>(X, Y, Z);
4+
5+
impl<V> Demo<V> {
6+
fn new() {}
7+
}
8+
9+
pub trait A<Group = ()> {
10+
type U: B;
11+
}
12+
13+
pub trait B {
14+
type V;
15+
}

tests/crashes/138240.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//@ known-bug: #138240
2+
//@edition:2024
3+
#![feature(min_generic_const_args)]
4+
#![feature(inherent_associated_types)]
5+
async fn _CF() -> Box<[u8; Box::b]> {
6+
Box::new(true)
7+
}
8+
9+
fn main() {}

tests/crashes/138265.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//@ known-bug: #138265
2+
3+
#![feature(coerce_unsized)]
4+
#![crate_type = "lib"]
5+
impl<A> std::ops::CoerceUnsized<A> for A {}
6+
pub fn f() {
7+
[0; {
8+
let mut c = &0;
9+
c = &0;
10+
0
11+
}]
12+
}

tests/crashes/138266.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//@ known-bug: #138266
2+
//@compile-flags: --crate-type=lib
3+
#![feature(min_generic_const_args)]
4+
#![feature(inherent_associated_types)]
5+
pub fn f(mut x: [u8; Box::b]) {
6+
x[72] = 1;
7+
}

tests/crashes/138359.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//@ known-bug: #138359
2+
#![feature(min_generic_const_args)]
3+
#![feature(inherent_associated_types)]
4+
struct a(Box<[u8; Box::b]>);
5+
impl a {
6+
fn c(self) { self.0.da }
7+
}
8+
fn main() {}

tests/crashes/138361.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//@ known-bug: #138361
2+
3+
fn main() {
4+
[0; loop{}];
5+
std::mem::transmute(4)
6+
}

tests/crashes/138510.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//@ known-bug: #138510
2+
fn main()
3+
where
4+
#[repr()]
5+
_: Sized,
6+
{
7+
}

tests/crashes/138534.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//@ known-bug: #138534
2+
//@compile-flags: -Zunpretty=expanded
3+
#[repr(bool)]
4+
pub enum TopFg {
5+
Bar,
6+
}

tests/crashes/138564.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//@ known-bug: #138564
2+
//@compile-flags: -Copt-level=0 -Cdebuginfo=2 --crate-type lib
3+
#![feature(unsize, dispatch_from_dyn, arbitrary_self_types)]
4+
5+
use std::marker::Unsize;
6+
use std::ops::{Deref, DispatchFromDyn};
7+
8+
#[repr(align(16))]
9+
pub struct MyPointer<T: ?Sized>(*const T);
10+
11+
impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<MyPointer<U>> for MyPointer<T> {}
12+
impl<T: ?Sized> Deref for MyPointer<T> {
13+
type Target = T;
14+
fn deref(&self) -> &T {
15+
unimplemented!()
16+
}
17+
}
18+
19+
pub trait Trait {
20+
fn foo(self: MyPointer<Self>) {}
21+
}
22+
23+
// make sure some usage of `<dyn Trait>::foo` makes it to codegen
24+
pub fn user() -> *const () {
25+
<dyn Trait>::foo as *const ()
26+
}

0 commit comments

Comments
 (0)