crashes: add latest batch of tests

This commit is contained in:
Matthias Krüger 2025-01-03 09:52:14 +01:00
parent f17cf744f5
commit 9444195e92
11 changed files with 184 additions and 0 deletions

11
tests/crashes/134336.rs Normal file
View file

@ -0,0 +1,11 @@
//@ known-bug: #134336
#![expect(incomplete_features)]
#![feature(explicit_tail_calls)]
trait Tr {
fn f();
}
fn g<T: Tr>() {
become T::f();
}

6
tests/crashes/134355.rs Normal file
View file

@ -0,0 +1,6 @@
//@ known-bug: #134355
//@compile-flags: --crate-type=lib
fn digit() -> str {
return { i32::MIN };
}

24
tests/crashes/134479.rs Normal file
View file

@ -0,0 +1,24 @@
//@ known-bug: #134479
//@ compile-flags: -Csymbol-mangling-version=v0 -Cdebuginfo=1
#![feature(generic_const_exprs)]
fn main() {
test::<2>();
}
struct Test<const N: usize>;
fn new<const N: usize>() -> Test<N>
where
[(); N * 1]: Sized,
{
Test
}
fn test<const N: usize>() -> Test<{ N - 1 }>
where
[(); (N - 1) * 1]: Sized,
{
new()
}

27
tests/crashes/134587.rs Normal file
View file

@ -0,0 +1,27 @@
//@ known-bug: #134587
use std::ops::Add;
pub fn foo<T>(slf: *const T)
where
*const T: Add,
{
slf + slf;
}
pub fn foo2<T>(slf: *const T)
where
*const T: Add<u8>,
{
slf + 1_u8;
}
pub trait TimesTwo
where *const Self: Add<*const Self>,
{
extern "C" fn t2_ptr(slf: *const Self)
-> <*const Self as Add<*const Self>>::Output {
slf + slf
}
}

16
tests/crashes/134615.rs Normal file
View file

@ -0,0 +1,16 @@
//@ known-bug: #134615
#![feature(generic_const_exprs)]
trait Trait {
const CONST: usize;
}
fn f()
where
for<'a> (): Trait,
[(); <() as Trait>::CONST]:,
{
}
pub fn main() {}

13
tests/crashes/134641.rs Normal file
View file

@ -0,0 +1,13 @@
//@ known-bug: #134641
#![feature(associated_const_equality)]
pub trait IsVoid {
const IS_VOID: bool;
}
impl IsVoid for () {
const IS_VOID: bool = true;
}
pub trait Maybe {}
impl Maybe for () {}
impl Maybe for () where (): IsVoid<IS_VOID = true> {}

12
tests/crashes/134654.rs Normal file
View file

@ -0,0 +1,12 @@
//@ known-bug: #134654
//@ compile-flags: -Zmir-enable-passes=+GVN -Zmir-enable-passes=+Inline -Zvalidate-mir
//@ only-x86_64
fn function_with_bytes<const BYTES:
&'static [u8; 0xa9008fb6c9d81e42_0e25730562a601c8_u128]>() -> &'static [u8] {
BYTES
}
fn main() {
function_with_bytes::<b"aa">() == &[];
}

14
tests/crashes/134838.rs Normal file
View file

@ -0,0 +1,14 @@
//@ known-bug: #134838
#![feature(type_ascription)]
#![allow(dead_code)]
struct Ty(());
fn mk() -> impl Sized {
if false {
let _ = type_ascribe!(mk(), Ty).0;
}
Ty(())
}
fn main() {}

16
tests/crashes/134905.rs Normal file
View file

@ -0,0 +1,16 @@
//@ known-bug: #134905
trait Iterate<'a> {
type Ty: Valid;
}
impl<'a, T> Iterate<'a> for T
where
T: Check,
{
default type Ty = ();
}
trait Check {}
impl<'a, T> Eq for T where <T as Iterate<'a>>::Ty: Valid {}
trait Valid {}

11
tests/crashes/135020.rs Normal file
View file

@ -0,0 +1,11 @@
//@ known-bug: #135020
pub fn problem_thingy(items: &mut impl Iterator<Item = str>) {
let mut peeker = items.peekable();
match peeker.peek() {
Some(_) => (),
None => return (),
}
}
pub fn main() {}

34
tests/crashes/135039.rs Normal file
View file

@ -0,0 +1,34 @@
//@ known-bug: #135039
//@ edition:2021
pub type UserId<Backend> = <<Backend as AuthnBackend>::User as AuthUser>::Id;
pub trait AuthUser {
type Id;
}
pub trait AuthnBackend {
type User: AuthUser;
}
pub struct AuthSession<Backend: AuthnBackend> {
user: Option<Backend::User>,
data: Option<UserId<Backend>>,
}
pub trait Authz: Sized {
type AuthnBackend: AuthnBackend<User = Self>;
}
pub trait Query<User: Authz> {
type Output;
async fn run(&self) -> Result<Self::Output, ()>;
}
pub async fn run_query<User: Authz, Q: Query<User> + 'static>(
auth: AuthSession<User::AuthnBackend>,
query: Q,
) -> Result<Q::Output, ()> {
let user = auth.user;
query.run().await
}