From 397a35d08193178958df4fbb9b912616ac7c4bed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 5 May 2024 23:41:08 +0200 Subject: [PATCH] crashes: add lastest batch of crash tests --- tests/crashes/124436.rs | 7 +++++++ tests/crashes/124440.rs | 23 +++++++++++++++++++++ tests/crashes/124464.rs | 17 +++++++++++++++ tests/crashes/124490.rs | 16 ++++++++++++++ tests/crashes/124552.rs | 12 +++++++++++ tests/crashes/124563.rs | 46 +++++++++++++++++++++++++++++++++++++++++ tests/crashes/124583.rs | 5 +++++ tests/crashes/124702.rs | 14 +++++++++++++ tests/crashes/124751.rs | 8 +++++++ 9 files changed, 148 insertions(+) create mode 100644 tests/crashes/124436.rs create mode 100644 tests/crashes/124440.rs create mode 100644 tests/crashes/124464.rs create mode 100644 tests/crashes/124490.rs create mode 100644 tests/crashes/124552.rs create mode 100644 tests/crashes/124563.rs create mode 100644 tests/crashes/124583.rs create mode 100644 tests/crashes/124702.rs create mode 100644 tests/crashes/124751.rs diff --git a/tests/crashes/124436.rs b/tests/crashes/124436.rs new file mode 100644 index 00000000000..aed830e8f0e --- /dev/null +++ b/tests/crashes/124436.rs @@ -0,0 +1,7 @@ +//@ known-bug: rust-lang/rust#124436 +//@ compile-flags: -Zdump-mir=all -Zpolymorphize=on + +pub trait TraitCat {} +pub trait TraitDog {} + +pub fn gamma(t: [TraitDog; 32]) {} diff --git a/tests/crashes/124440.rs b/tests/crashes/124440.rs new file mode 100644 index 00000000000..431c4e444f1 --- /dev/null +++ b/tests/crashes/124440.rs @@ -0,0 +1,23 @@ +//@ known-bug: rust-lang/rust#124440 + +#![allow(warnings)] + +trait Foo {} + +impl Foo for F where F: FnMut(&()) {} + +struct Bar { + f: F, +} + +impl Foo for Bar where F: Foo {} + +fn assert_foo(_: F) +where + Bar: Foo, +{ +} + +fn main() { + assert_foo(|_| ()); +} diff --git a/tests/crashes/124464.rs b/tests/crashes/124464.rs new file mode 100644 index 00000000000..471479f5cf1 --- /dev/null +++ b/tests/crashes/124464.rs @@ -0,0 +1,17 @@ +//@ known-bug: rust-lang/rust #124464 +enum TestOption { + TestSome(T), + TestSome(T), +} + +pub struct Request { + bar: TestOption, + bar: u8, +} + +fn default_instance() -> &'static Request { + static instance: Request = Request { bar: 17 }; + &instance +} + +pub fn main() {} diff --git a/tests/crashes/124490.rs b/tests/crashes/124490.rs new file mode 100644 index 00000000000..9f605c32cf2 --- /dev/null +++ b/tests/crashes/124490.rs @@ -0,0 +1,16 @@ +//@ known-bug: rust-lang/rust#124490 +use io::{self as std}; +use std::collections::{self as io}; + +mod a { + pub mod b { + pub mod c {} + } +} + +use a::*; + +use b::c; +use c as b; + +fn main() {} diff --git a/tests/crashes/124552.rs b/tests/crashes/124552.rs new file mode 100644 index 00000000000..5320ce27843 --- /dev/null +++ b/tests/crashes/124552.rs @@ -0,0 +1,12 @@ +//@ known-bug: rust-lang/rust#124552 + +struct B; + +struct Foo { + b: u32, + b: B, +} + +static BAR: Foo = Foo { b: B }; + +fn main() {} diff --git a/tests/crashes/124563.rs b/tests/crashes/124563.rs new file mode 100644 index 00000000000..b082739af53 --- /dev/null +++ b/tests/crashes/124563.rs @@ -0,0 +1,46 @@ +//@ known-bug: rust-lang/rust#124563 + +use std::marker::PhantomData; + +pub trait Trait {} + +pub trait Foo { + type Trait: Trait; + type Bar: Bar; + fn foo(&mut self); +} + +pub struct FooImpl<'a, 'b, A: Trait>(PhantomData<&'a &'b A>); + +impl<'a, 'b, T> Foo for FooImpl<'a, 'b, T> +where + T: Trait, +{ + type Trait = T; + type Bar = BarImpl<'a, 'b, T>; + + fn foo(&mut self) { + self.enter_scope(|ctx| { + BarImpl(ctx); + }); + } +} + +impl<'a, 'b, T> FooImpl<'a, 'b, T> +where + T: Trait, +{ + fn enter_scope(&mut self, _scope: impl FnOnce(&mut Self)) {} +} +pub trait Bar { + type Foo: Foo; +} + +pub struct BarImpl<'a, 'b, T: Trait>(&'b mut FooImpl<'a, 'b, T>); + +impl<'a, 'b, T> Bar for BarImpl<'a, 'b, T> +where + T: Trait, +{ + type Foo = FooImpl<'a, 'b, T>; +} diff --git a/tests/crashes/124583.rs b/tests/crashes/124583.rs new file mode 100644 index 00000000000..ffd9d7521ad --- /dev/null +++ b/tests/crashes/124583.rs @@ -0,0 +1,5 @@ +//@ known-bug: rust-lang/rust#124583 + +fn main() { + let _ = -(-0.0f16); +} diff --git a/tests/crashes/124702.rs b/tests/crashes/124702.rs new file mode 100644 index 00000000000..e3767dec403 --- /dev/null +++ b/tests/crashes/124702.rs @@ -0,0 +1,14 @@ +//@ known-bug: rust-lang/rust#124702 +//@ compile-flags: -Znext-solver=coherence +trait X {} + +trait Z { + type Assoc: Y; +} +struct A(T); + +impl Z for A { + type Assoc = T; +} + +impl From<> as Z>::Assoc> for T {} diff --git a/tests/crashes/124751.rs b/tests/crashes/124751.rs new file mode 100644 index 00000000000..f15e39965d3 --- /dev/null +++ b/tests/crashes/124751.rs @@ -0,0 +1,8 @@ +//@ known-bug: rust-lang/rust#124751 +//@ compile-flags: -Zunstable-options --edition=2024 + +#![feature(gen_blocks)] + +fn main() { + let _ = async gen || {}; +}