From fa4816bca029f5b743ad436fd9bc610c99e5a613 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sat, 28 Sep 2024 13:07:54 +0200 Subject: [PATCH] crashes: more tests --- tests/crashes/130521.rs | 13 +++++++++++++ tests/crashes/130524.rs | 22 ++++++++++++++++++++++ tests/crashes/130627.rs | 20 ++++++++++++++++++++ tests/crashes/130687.rs | 3 +++ tests/crashes/130779.rs | 11 +++++++++++ tests/crashes/130921.rs | 10 ++++++++++ tests/crashes/130970.rs | 9 +++++++++ 7 files changed, 88 insertions(+) create mode 100644 tests/crashes/130521.rs create mode 100644 tests/crashes/130524.rs create mode 100644 tests/crashes/130627.rs create mode 100644 tests/crashes/130687.rs create mode 100644 tests/crashes/130779.rs create mode 100644 tests/crashes/130921.rs create mode 100644 tests/crashes/130970.rs diff --git a/tests/crashes/130521.rs b/tests/crashes/130521.rs new file mode 100644 index 0000000000000..2d30b658024e0 --- /dev/null +++ b/tests/crashes/130521.rs @@ -0,0 +1,13 @@ +//@ known-bug: #130521 + +#![feature(object_safe_for_dispatch)] +struct Vtable(dyn Cap); + +trait Cap<'a> {} + +union Transmute { + t: u64, + u: &'static Vtable, +} + +const G: &Copy = unsafe { Transmute { t: 1 }.u }; diff --git a/tests/crashes/130524.rs b/tests/crashes/130524.rs new file mode 100644 index 0000000000000..14d2269de5980 --- /dev/null +++ b/tests/crashes/130524.rs @@ -0,0 +1,22 @@ +//@ known-bug: #130524 + +trait Transform { + type Output<'a>; +} + +trait Propagate {} + +fn new_node(_c: Vec Propagate<::Output<'a>>>>) -> T { + todo!() +} + +impl Propagate for T {} +struct Noop; + +impl Transform for Noop { + type Output<'a> = (); +} + +fn main() { + let _node: Noop = new_node(vec![Box::new(Noop)]); +} diff --git a/tests/crashes/130627.rs b/tests/crashes/130627.rs new file mode 100644 index 0000000000000..59d3606592bf1 --- /dev/null +++ b/tests/crashes/130627.rs @@ -0,0 +1,20 @@ +//@ known-bug: #130627 + +#![feature(trait_alias)] + +trait Test {} + +#[diagnostic::on_unimplemented( + message="message", + label="label", + note="note" +)] +trait Alias = Test; + +// Use trait alias as bound on type parameter. +fn foo(v: &T) { +} + +pub fn main() { + foo(&1); +} diff --git a/tests/crashes/130687.rs b/tests/crashes/130687.rs new file mode 100644 index 0000000000000..e819aa11c263c --- /dev/null +++ b/tests/crashes/130687.rs @@ -0,0 +1,3 @@ +//@ known-bug: #130687 +pub struct Data([u8; usize::MAX >> 16]); +const _: &'static Data = &Data([0; usize::MAX >> 16]); diff --git a/tests/crashes/130779.rs b/tests/crashes/130779.rs new file mode 100644 index 0000000000000..f0fd81fff4449 --- /dev/null +++ b/tests/crashes/130779.rs @@ -0,0 +1,11 @@ +//@ known-bug: #130779 +#![feature(never_patterns)] + +enum E { A } + +fn main() { + match E::A { + ! | + if true => {} + } +} diff --git a/tests/crashes/130921.rs b/tests/crashes/130921.rs new file mode 100644 index 0000000000000..b7cb1303937e6 --- /dev/null +++ b/tests/crashes/130921.rs @@ -0,0 +1,10 @@ +//@ known-bug: #130921 +//@ compile-flags: -Zvalidate-mir -Copt-level=0 --crate-type lib + +pub fn hello() -> [impl Sized; 2] { + if false { + let x = hello(); + let _: &[i32] = &x; + } + todo!() +} diff --git a/tests/crashes/130970.rs b/tests/crashes/130970.rs new file mode 100644 index 0000000000000..e1f59c155a56a --- /dev/null +++ b/tests/crashes/130970.rs @@ -0,0 +1,9 @@ +//@ known-bug: #130970 +//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir + +fn main() { + extern "C" { + static symbol: [usize]; + } + println!("{}", symbol[0]); +}