add more crash tests
This commit is contained in:
parent
4203c68613
commit
6774856e0c
37
tests/crashes/130956.rs
Normal file
37
tests/crashes/130956.rs
Normal file
@ -0,0 +1,37 @@
|
||||
//@ known-bug: #130956
|
||||
|
||||
mod impl_trait_mod {
|
||||
use super::*;
|
||||
pub type OpaqueBlock = impl Trait;
|
||||
pub type OpaqueIf = impl Trait;
|
||||
|
||||
pub struct BlockWrapper(OpaqueBlock);
|
||||
pub struct IfWrapper(pub OpaqueIf);
|
||||
|
||||
pub fn if_impl() -> Parser<OpaqueIf> {
|
||||
bind(option(block()), |_| block())
|
||||
}
|
||||
}
|
||||
use impl_trait_mod::*;
|
||||
|
||||
pub trait Trait {
|
||||
type Assoc;
|
||||
}
|
||||
pub struct Parser<P>(P);
|
||||
pub struct Bind<P, F>(P, F);
|
||||
impl<P, F> Trait for Bind<P, F> { type Assoc = (); }
|
||||
impl Trait for BlockWrapper { type Assoc = (); }
|
||||
impl Trait for IfWrapper { type Assoc = (); }
|
||||
|
||||
pub fn block() -> Parser<BlockWrapper> {
|
||||
loop {}
|
||||
}
|
||||
pub fn option<P: Trait>(arg: Parser<P>) -> Parser<impl Trait> {
|
||||
bind(arg, |_| block())
|
||||
}
|
||||
fn bind<P: Trait, P2, F: Fn(P::Assoc) -> Parser<P2>>(_: Parser<P>, _: F) -> Parser<Bind<P, F>>
|
||||
{ loop {} }
|
||||
|
||||
fn main() {
|
||||
if_impl().0;
|
||||
}
|
13
tests/crashes/130967.rs
Normal file
13
tests/crashes/130967.rs
Normal file
@ -0,0 +1,13 @@
|
||||
//@ known-bug: #130967
|
||||
|
||||
trait Producer {
|
||||
type Produced;
|
||||
fn make_one() -> Self::Produced;
|
||||
}
|
||||
|
||||
impl<E: ?Sized> Producer for () {
|
||||
type Produced = Option<E>;
|
||||
fn make_one() -> Self::Produced {
|
||||
loop {}
|
||||
}
|
||||
}
|
15
tests/crashes/131046.rs
Normal file
15
tests/crashes/131046.rs
Normal file
@ -0,0 +1,15 @@
|
||||
//@ known-bug: #131046
|
||||
|
||||
trait Owner {
|
||||
const C<const N: u32>: u32;
|
||||
}
|
||||
|
||||
impl Owner for () {
|
||||
const C<const N: u32>: u32 = N;
|
||||
}
|
||||
|
||||
fn take0<const N: u64>(_: impl Owner<C<N> = { N }>) {}
|
||||
|
||||
fn main() {
|
||||
take0::<128>(());
|
||||
}
|
7
tests/crashes/131048.rs
Normal file
7
tests/crashes/131048.rs
Normal file
@ -0,0 +1,7 @@
|
||||
//@ known-bug: #131048
|
||||
|
||||
impl<A> std::ops::CoerceUnsized<A> for A {}
|
||||
|
||||
fn main() {
|
||||
format_args!("Hello, world!");
|
||||
}
|
27
tests/crashes/131050.rs
Normal file
27
tests/crashes/131050.rs
Normal file
@ -0,0 +1,27 @@
|
||||
//@ known-bug: #131050
|
||||
//@ compile-flags: --edition=2021
|
||||
|
||||
fn query_as<D>() {}
|
||||
|
||||
async fn create_user() {
|
||||
query_as();
|
||||
}
|
||||
|
||||
async fn post_user_filter() -> impl Filter {
|
||||
AndThen(&(), || async { create_user().await })
|
||||
}
|
||||
|
||||
async fn get_app() -> impl Send {
|
||||
post_user_filter().await
|
||||
}
|
||||
|
||||
trait Filter {}
|
||||
|
||||
struct AndThen<T, F>(T, F);
|
||||
|
||||
impl<T, F, R> Filter for AndThen<T, F>
|
||||
where
|
||||
F: Fn() -> R,
|
||||
R: Send,
|
||||
{
|
||||
}
|
8
tests/crashes/131052.rs
Normal file
8
tests/crashes/131052.rs
Normal file
@ -0,0 +1,8 @@
|
||||
//@ known-bug: #131052
|
||||
#![feature(adt_const_params)]
|
||||
|
||||
struct ConstBytes<const T: &'static [*mut u8; 3]>;
|
||||
|
||||
pub fn main() {
|
||||
let _: ConstBytes<b"AAA"> = ConstBytes::<b"BBB">;
|
||||
}
|
12
tests/crashes/131101.rs
Normal file
12
tests/crashes/131101.rs
Normal file
@ -0,0 +1,12 @@
|
||||
//@ known-bug: #131101
|
||||
trait Foo<const N: u8> {
|
||||
fn do_x(&self) -> [u8; N];
|
||||
}
|
||||
|
||||
struct Bar;
|
||||
|
||||
impl Foo<const 3> for Bar {
|
||||
fn do_x(&self) -> [u8; 3] {
|
||||
[0u8; 3]
|
||||
}
|
||||
}
|
4
tests/crashes/131102.rs
Normal file
4
tests/crashes/131102.rs
Normal file
@ -0,0 +1,4 @@
|
||||
//@ known-bug: #131102
|
||||
pub struct Blorb<const N: u16>([String; N]);
|
||||
pub struct Wrap(Blorb<0>);
|
||||
pub const fn i(_: Wrap) {}
|
6
tests/crashes/131103.rs
Normal file
6
tests/crashes/131103.rs
Normal file
@ -0,0 +1,6 @@
|
||||
//@ known-bug: #131103
|
||||
struct Struct<const N: i128>(pub [u8; N]);
|
||||
|
||||
pub fn function(value: Struct<3>) -> u8 {
|
||||
value.0[0]
|
||||
}
|
19
tests/crashes/131190.rs
Normal file
19
tests/crashes/131190.rs
Normal file
@ -0,0 +1,19 @@
|
||||
//@ known-bug: #131190
|
||||
//@ compile-flags: -Cinstrument-coverage --edition=2018
|
||||
|
||||
use std::future::Future;
|
||||
|
||||
pub fn block_on<T>(fut: impl Future<Output = T>) -> T {}
|
||||
|
||||
async fn call_once(f: impl async FnOnce(DropMe)) {
|
||||
f(DropMe("world")).await;
|
||||
}
|
||||
|
||||
struct DropMe(&'static str);
|
||||
|
||||
pub fn main() {
|
||||
block_on(async {
|
||||
let async_closure = async move |a: DropMe| {};
|
||||
call_once(async_closure).await;
|
||||
});
|
||||
}
|
16
tests/crashes/131227.rs
Normal file
16
tests/crashes/131227.rs
Normal file
@ -0,0 +1,16 @@
|
||||
//@ known-bug: #131227
|
||||
//@ compile-flags: -Zmir-opt-level=3
|
||||
|
||||
static mut G: () = ();
|
||||
|
||||
fn myfunc() -> i32 {
|
||||
let var = &raw mut G;
|
||||
if var.is_null() {
|
||||
return 0;
|
||||
}
|
||||
0
|
||||
}
|
||||
|
||||
fn main() {
|
||||
myfunc();
|
||||
}
|
7
tests/crashes/131292.rs
Normal file
7
tests/crashes/131292.rs
Normal file
@ -0,0 +1,7 @@
|
||||
//@ known-bug: #131292
|
||||
//@ only-x86_64
|
||||
use std::arch::asm;
|
||||
|
||||
unsafe fn f6() {
|
||||
asm!(concat!(r#"lJÆ<F0908FBF>.<>"#, "{}/day{:02}.txt"));
|
||||
}
|
25
tests/crashes/131294-2.rs
Normal file
25
tests/crashes/131294-2.rs
Normal file
@ -0,0 +1,25 @@
|
||||
//@ known-bug: #131294
|
||||
//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir -Zcross-crate-inline-threshold=always
|
||||
|
||||
// https://github.com/rust-lang/rust/issues/131294#issuecomment-2395088049 second comment
|
||||
struct Rows;
|
||||
|
||||
impl Iterator for Rows {
|
||||
type Item = String;
|
||||
|
||||
fn next() -> Option<String> {
|
||||
let args = format_args!("Hello world");
|
||||
|
||||
{
|
||||
match args.as_str() {
|
||||
Some(t) => t.to_owned(),
|
||||
None => String::new(),
|
||||
}
|
||||
}
|
||||
.into()
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
Rows.next();
|
||||
}
|
16
tests/crashes/131294.rs
Normal file
16
tests/crashes/131294.rs
Normal file
@ -0,0 +1,16 @@
|
||||
//@ known-bug: #131294
|
||||
//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir -Zcross-crate-inline-threshold=always
|
||||
|
||||
struct Rows;
|
||||
|
||||
impl Iterator for Rows {
|
||||
type Item = String;
|
||||
|
||||
fn next() -> Option<Self::Item> {
|
||||
std::fmt::format(format_args!("Hello world")).into()
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
Rows.next();
|
||||
}
|
9
tests/crashes/131295.rs
Normal file
9
tests/crashes/131295.rs
Normal file
@ -0,0 +1,9 @@
|
||||
//@ known-bug: #131295
|
||||
|
||||
#![feature(generic_const_exprs)]
|
||||
|
||||
async fn foo<'a>() -> [(); {
|
||||
let _y: &'a ();
|
||||
4
|
||||
}] {
|
||||
}
|
12
tests/crashes/131298.rs
Normal file
12
tests/crashes/131298.rs
Normal file
@ -0,0 +1,12 @@
|
||||
//@ known-bug: #131298
|
||||
|
||||
fn dyn_hoops<T>() -> *const dyn Iterator<Item = impl Captures> {
|
||||
loop {}
|
||||
}
|
||||
|
||||
mod typeck {
|
||||
type Opaque = impl Sized;
|
||||
fn define() -> Opaque {
|
||||
let _: Opaque = super::dyn_hoops::<u8>();
|
||||
}
|
||||
}
|
40
tests/crashes/131342-2.rs
Normal file
40
tests/crashes/131342-2.rs
Normal file
@ -0,0 +1,40 @@
|
||||
//@ known-bug: #131342
|
||||
// see also: 131342.rs
|
||||
|
||||
fn main() {
|
||||
problem_thingy(Once);
|
||||
}
|
||||
|
||||
struct Once;
|
||||
|
||||
impl Iterator for Once {
|
||||
type Item = ();
|
||||
}
|
||||
|
||||
fn problem_thingy(items: impl Iterator) {
|
||||
let peeker = items.peekable();
|
||||
problem_thingy(&peeker);
|
||||
}
|
||||
|
||||
trait Iterator {
|
||||
type Item;
|
||||
|
||||
fn peekable(self) -> Peekable<Self>
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
loop {}
|
||||
}
|
||||
}
|
||||
|
||||
struct Peekable<I: Iterator> {
|
||||
_peeked: I::Item,
|
||||
}
|
||||
|
||||
impl<I: Iterator> Iterator for Peekable<I> {
|
||||
type Item = I::Item;
|
||||
}
|
||||
|
||||
impl<I: Iterator + ?Sized> Iterator for &I {
|
||||
type Item = I::Item;
|
||||
}
|
16
tests/crashes/131342.rs
Normal file
16
tests/crashes/131342.rs
Normal file
@ -0,0 +1,16 @@
|
||||
//@ known-bug: #131342
|
||||
// see also: 131342-2.rs
|
||||
|
||||
fn main() {
|
||||
let mut items = vec![1, 2, 3, 4, 5].into_iter();
|
||||
problem_thingy(&mut items);
|
||||
}
|
||||
|
||||
fn problem_thingy(items: &mut impl Iterator<Item = u8>) {
|
||||
let mut peeker = items.peekable();
|
||||
match peeker.peek() {
|
||||
Some(_) => (),
|
||||
None => return (),
|
||||
}
|
||||
problem_thingy(&mut peeker);
|
||||
}
|
9
tests/crashes/131347.rs
Normal file
9
tests/crashes/131347.rs
Normal file
@ -0,0 +1,9 @@
|
||||
//@ known-bug: #131347
|
||||
//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir
|
||||
|
||||
struct S;
|
||||
static STUFF: [i8] = [0; S::N];
|
||||
|
||||
fn main() {
|
||||
assert_eq!(STUFF, [0; 63]);
|
||||
}
|
33
tests/crashes/131373.rs
Normal file
33
tests/crashes/131373.rs
Normal file
@ -0,0 +1,33 @@
|
||||
//@ known-bug: #131373
|
||||
|
||||
trait LockReference: 'static {
|
||||
type Ref<'a>;
|
||||
}
|
||||
|
||||
struct SliceRef<'a, T: ?Sized> {
|
||||
_x: &'a T,
|
||||
}
|
||||
|
||||
impl<'a, T: ?Sized, SR: LockReference> IntoIterator for SliceRef<'a, T>
|
||||
where
|
||||
&'a T: IntoIterator<Item = &'a SR>,
|
||||
{
|
||||
type Item = SR::Ref<'a>;
|
||||
type IntoIter = std::iter::Map<<&'a T as IntoIterator>::IntoIter,
|
||||
for<'c> fn(&'c SR) -> SR::Ref<'c>>;
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
loop {}
|
||||
}
|
||||
}
|
||||
|
||||
impl LockReference for () {
|
||||
type Ref<'a> = ();
|
||||
}
|
||||
|
||||
fn locked() -> SliceRef<'static, [()]> {
|
||||
loop {}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let _ = locked().into_iter();
|
||||
}
|
12
tests/crashes/131406.rs
Normal file
12
tests/crashes/131406.rs
Normal file
@ -0,0 +1,12 @@
|
||||
//@ known-bug: #131406
|
||||
|
||||
trait Owner {
|
||||
const C<const N: u32>: u32 = N;
|
||||
}
|
||||
|
||||
impl Owner for () {}
|
||||
fn take0<const N: u64>(_: impl Owner<C<N> = { N }>) {}
|
||||
|
||||
fn main() {
|
||||
take0::<128>(());
|
||||
}
|
Loading…
Reference in New Issue
Block a user