Skip to content

crashes: add latest batch of tests #135061

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions tests/crashes/134336.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 6 additions & 0 deletions tests/crashes/134355.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//@ known-bug: #134355

//@compile-flags: --crate-type=lib
fn digit() -> str {
return { i32::MIN };
}
24 changes: 24 additions & 0 deletions tests/crashes/134479.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 27 additions & 0 deletions tests/crashes/134587.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 16 additions & 0 deletions tests/crashes/134615.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 13 additions & 0 deletions tests/crashes/134641.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 12 additions & 0 deletions tests/crashes/134654.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 14 additions & 0 deletions tests/crashes/134838.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 16 additions & 0 deletions tests/crashes/134905.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 11 additions & 0 deletions tests/crashes/135020.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 34 additions & 0 deletions tests/crashes/135039.rs
Original file line number Diff line number Diff line change
@@ -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
}
Loading