about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-06-30 00:06:27 +0000
committerbors <bors@rust-lang.org>2024-06-30 00:06:27 +0000
commitbf750f5db5c57257d1e566f04f1962f80d9d5085 (patch)
treeca0a74a65468e1e45503b1e9fd1a223a43e9e3da
parentba1d7f4a083e6402679105115ded645512a7aea8 (diff)
parentc59e7fd95b985cb3622cdbf46cf31b7b250a0342 (diff)
downloadrust-bf750f5db5c57257d1e566f04f1962f80d9d5085.tar.gz
rust-bf750f5db5c57257d1e566f04f1962f80d9d5085.zip
Auto merge of #126869 - matthiaskrgr:kaboom, r=jieyouxu
crashes: add more tests
-rw-r--r--tests/crashes/126646.rs18
-rw-r--r--tests/crashes/126648.rs8
-rw-r--r--tests/crashes/126666.rs18
-rw-r--r--tests/crashes/126667.rs14
-rw-r--r--tests/crashes/126680.rs21
-rw-r--r--tests/crashes/126696.rs24
-rw-r--r--tests/crashes/126725.rs20
-rw-r--r--tests/crashes/126744.rs8
-rw-r--r--tests/crashes/126850.rs11
9 files changed, 142 insertions, 0 deletions
diff --git a/tests/crashes/126646.rs b/tests/crashes/126646.rs
new file mode 100644
index 00000000000..24e3530320a
--- /dev/null
+++ b/tests/crashes/126646.rs
@@ -0,0 +1,18 @@
+//@ known-bug: rust-lang/rust#126646
+mod foo {
+    pub trait Callable {
+        type Output;
+        fn call() -> Self::Output;
+    }
+
+    impl<'a, V: ?Sized> Callable for &'a () {
+        type Output = ();
+    }
+}
+use foo::*;
+
+fn test<'a>() -> impl Sized {
+    <&'a () as Callable>::call()
+}
+
+fn main() {}
diff --git a/tests/crashes/126648.rs b/tests/crashes/126648.rs
new file mode 100644
index 00000000000..1cf3e44bba9
--- /dev/null
+++ b/tests/crashes/126648.rs
@@ -0,0 +1,8 @@
+//@ known-bug: rust-lang/rust#126648
+struct Outest(*const &'a ());
+
+fn make() -> Outest {}
+
+fn main() {
+    if let Outest("foo") = make() {}
+}
diff --git a/tests/crashes/126666.rs b/tests/crashes/126666.rs
new file mode 100644
index 00000000000..58526707c9a
--- /dev/null
+++ b/tests/crashes/126666.rs
@@ -0,0 +1,18 @@
+//@ known-bug: rust-lang/rust#126666
+#![feature(const_mut_refs)]
+#![feature(const_refs_to_static)]
+#![feature(object_safe_for_dispatch)]
+
+struct Meh {
+    x: &'static dyn UnsafeCell,
+}
+
+const MUH: Meh = Meh {
+    x: &mut *(&READONLY as *const _ as *mut _),
+};
+
+static READONLY: i32 = 0;
+
+trait UnsafeCell<'a> {}
+
+pub fn main() {}
diff --git a/tests/crashes/126667.rs b/tests/crashes/126667.rs
new file mode 100644
index 00000000000..27b170d6da5
--- /dev/null
+++ b/tests/crashes/126667.rs
@@ -0,0 +1,14 @@
+//@ known-bug: rust-lang/rust#126667
+#![warn(rust_2021_compatibility)]
+
+trait Static<'a> {}
+
+struct Foo((u32, u32));
+
+fn main() {
+    type T = impl Static;
+    let foo: T = Foo((1u32, 2u32));
+    let x = move || {
+        let Foo((a, b)) = foo;
+    };
+}
diff --git a/tests/crashes/126680.rs b/tests/crashes/126680.rs
new file mode 100644
index 00000000000..b1566d5e6be
--- /dev/null
+++ b/tests/crashes/126680.rs
@@ -0,0 +1,21 @@
+//@ known-bug: rust-lang/rust#126680
+//@ compile-flags: -Zvalidate-mir
+#![feature(type_alias_impl_trait)]
+type Bar = impl std::fmt::Display;
+
+use std::path::Path;
+
+struct A {
+    pub func: fn(check: Bar, b: Option<&Path>),
+}
+const MY_A: A = A {
+    func: |check, b| {
+        if check {
+            ()
+        } else if let Some(_) = b.and_then(|p| p.parent()) {
+            ()
+        }
+    },
+};
+
+fn main() {}
diff --git a/tests/crashes/126696.rs b/tests/crashes/126696.rs
new file mode 100644
index 00000000000..51dcf6cf294
--- /dev/null
+++ b/tests/crashes/126696.rs
@@ -0,0 +1,24 @@
+//@ known-bug: rust-lang/rust#126696
+#![feature(generic_const_exprs)]
+#![allow(incomplete_features)]
+
+fn can_double<const N: usize>(x: [(); N])
+where
+    [(); N * 2]:,
+{
+    x[0];
+    unimplemented!()
+}
+
+fn foo<const N: usize>()
+where
+    [(); (N + 1) * 2]:,
+{
+    can_double([(); { N + 1 }]);
+    // Adding an explicit constant generic causes the ICE to go away
+    // can_double::<{N + 1}>([(); { N + 1 }]);
+}
+
+fn main() {
+    foo::<1>();
+}
diff --git a/tests/crashes/126725.rs b/tests/crashes/126725.rs
new file mode 100644
index 00000000000..d7a7d21ae42
--- /dev/null
+++ b/tests/crashes/126725.rs
@@ -0,0 +1,20 @@
+//@ known-bug: rust-lang/rust#126725
+trait Foo {
+    fn foo<'a>(&'a self) -> <&'a impl Sized as Bar>::Output;
+}
+
+trait Bar {
+    type Output;
+}
+
+struct X(i32);
+
+impl<'a> Bar for &'a X {
+    type Output = &'a i32;
+}
+
+impl Foo for X {
+    fn foo<'a>(&'a self) -> <&'a Self as Bar>::Output {
+        &self.0
+    }
+}
diff --git a/tests/crashes/126744.rs b/tests/crashes/126744.rs
new file mode 100644
index 00000000000..ed562c86e61
--- /dev/null
+++ b/tests/crashes/126744.rs
@@ -0,0 +1,8 @@
+//@ known-bug: rust-lang/rust#126744
+struct X {,}
+
+fn main() {
+    || {
+        if let X { x: 1,} = (X {}) {}
+    };
+}
diff --git a/tests/crashes/126850.rs b/tests/crashes/126850.rs
new file mode 100644
index 00000000000..0ddc24c8bb1
--- /dev/null
+++ b/tests/crashes/126850.rs
@@ -0,0 +1,11 @@
+//@ known-bug: rust-lang/rust#126850
+fn bug<T>() -> impl Iterator<
+    Item = [(); {
+               |found: &String| Some(false);
+               4
+           }],
+> {
+    std::iter::empty()
+}
+
+fn main() {}