From 9444195e92129373f2dca68960177eddfde44733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Fri, 3 Jan 2025 09:52:14 +0100 Subject: [PATCH] crashes: add latest batch of tests --- tests/crashes/134336.rs | 11 +++++++++++ tests/crashes/134355.rs | 6 ++++++ tests/crashes/134479.rs | 24 ++++++++++++++++++++++++ tests/crashes/134587.rs | 27 +++++++++++++++++++++++++++ tests/crashes/134615.rs | 16 ++++++++++++++++ tests/crashes/134641.rs | 13 +++++++++++++ tests/crashes/134654.rs | 12 ++++++++++++ tests/crashes/134838.rs | 14 ++++++++++++++ tests/crashes/134905.rs | 16 ++++++++++++++++ tests/crashes/135020.rs | 11 +++++++++++ tests/crashes/135039.rs | 34 ++++++++++++++++++++++++++++++++++ 11 files changed, 184 insertions(+) create mode 100644 tests/crashes/134336.rs create mode 100644 tests/crashes/134355.rs create mode 100644 tests/crashes/134479.rs create mode 100644 tests/crashes/134587.rs create mode 100644 tests/crashes/134615.rs create mode 100644 tests/crashes/134641.rs create mode 100644 tests/crashes/134654.rs create mode 100644 tests/crashes/134838.rs create mode 100644 tests/crashes/134905.rs create mode 100644 tests/crashes/135020.rs create mode 100644 tests/crashes/135039.rs diff --git a/tests/crashes/134336.rs b/tests/crashes/134336.rs new file mode 100644 index 0000000000000..14b88e14f04f0 --- /dev/null +++ b/tests/crashes/134336.rs @@ -0,0 +1,11 @@ +//@ known-bug: #134336 +#![expect(incomplete_features)] +#![feature(explicit_tail_calls)] + +trait Tr { + fn f(); +} + +fn g() { + become T::f(); +} diff --git a/tests/crashes/134355.rs b/tests/crashes/134355.rs new file mode 100644 index 0000000000000..b662341e6b1b3 --- /dev/null +++ b/tests/crashes/134355.rs @@ -0,0 +1,6 @@ +//@ known-bug: #134355 + +//@compile-flags: --crate-type=lib +fn digit() -> str { + return { i32::MIN }; +} diff --git a/tests/crashes/134479.rs b/tests/crashes/134479.rs new file mode 100644 index 0000000000000..0e4ddb2bfd56d --- /dev/null +++ b/tests/crashes/134479.rs @@ -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; + +fn new() -> Test +where + [(); N * 1]: Sized, +{ + Test +} + +fn test() -> Test<{ N - 1 }> +where + [(); (N - 1) * 1]: Sized, +{ + new() +} diff --git a/tests/crashes/134587.rs b/tests/crashes/134587.rs new file mode 100644 index 0000000000000..6d4441012e062 --- /dev/null +++ b/tests/crashes/134587.rs @@ -0,0 +1,27 @@ +//@ known-bug: #134587 + +use std::ops::Add; + +pub fn foo(slf: *const T) +where + *const T: Add, +{ + slf + slf; +} + +pub fn foo2(slf: *const T) +where + *const T: Add, +{ + 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 + } +} diff --git a/tests/crashes/134615.rs b/tests/crashes/134615.rs new file mode 100644 index 0000000000000..d7aa51389a0d7 --- /dev/null +++ b/tests/crashes/134615.rs @@ -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() {} diff --git a/tests/crashes/134641.rs b/tests/crashes/134641.rs new file mode 100644 index 0000000000000..e3e5ab69287b7 --- /dev/null +++ b/tests/crashes/134641.rs @@ -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 {} diff --git a/tests/crashes/134654.rs b/tests/crashes/134654.rs new file mode 100644 index 0000000000000..8a8d18359e96f --- /dev/null +++ b/tests/crashes/134654.rs @@ -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() -> &'static [u8] { + BYTES +} + +fn main() { + function_with_bytes::() == &[]; +} diff --git a/tests/crashes/134838.rs b/tests/crashes/134838.rs new file mode 100644 index 0000000000000..ac8af09b31bbd --- /dev/null +++ b/tests/crashes/134838.rs @@ -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() {} diff --git a/tests/crashes/134905.rs b/tests/crashes/134905.rs new file mode 100644 index 0000000000000..9f0f0f4b3f227 --- /dev/null +++ b/tests/crashes/134905.rs @@ -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 >::Ty: Valid {} + +trait Valid {} diff --git a/tests/crashes/135020.rs b/tests/crashes/135020.rs new file mode 100644 index 0000000000000..b44056eb3af30 --- /dev/null +++ b/tests/crashes/135020.rs @@ -0,0 +1,11 @@ +//@ known-bug: #135020 + +pub fn problem_thingy(items: &mut impl Iterator) { + let mut peeker = items.peekable(); + match peeker.peek() { + Some(_) => (), + None => return (), + } +} + +pub fn main() {} diff --git a/tests/crashes/135039.rs b/tests/crashes/135039.rs new file mode 100644 index 0000000000000..c4c5336fd4fdd --- /dev/null +++ b/tests/crashes/135039.rs @@ -0,0 +1,34 @@ +//@ known-bug: #135039 +//@ edition:2021 + +pub type UserId = <::User as AuthUser>::Id; + +pub trait AuthUser { + type Id; +} + +pub trait AuthnBackend { + type User: AuthUser; +} + +pub struct AuthSession { + user: Option, + data: Option>, +} + +pub trait Authz: Sized { + type AuthnBackend: AuthnBackend; +} + +pub trait Query { + type Output; + async fn run(&self) -> Result; +} + +pub async fn run_query + 'static>( + auth: AuthSession, + query: Q, +) -> Result { + let user = auth.user; + query.run().await +}