about summary refs log tree commit diff
path: root/src/test/ui/const-generics/generic_const_exprs/issue-80742.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/const-generics/generic_const_exprs/issue-80742.rs')
-rw-r--r--src/test/ui/const-generics/generic_const_exprs/issue-80742.rs32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-80742.rs b/src/test/ui/const-generics/generic_const_exprs/issue-80742.rs
new file mode 100644
index 00000000000..275f6995302
--- /dev/null
+++ b/src/test/ui/const-generics/generic_const_exprs/issue-80742.rs
@@ -0,0 +1,32 @@
+// check-fail
+
+// This test used to cause an ICE in rustc_mir::interpret::step::eval_rvalue_into_place
+
+#![allow(incomplete_features)]
+#![feature(generic_const_exprs)]
+
+use std::fmt::Debug;
+use std::marker::PhantomData;
+use std::mem::size_of;
+
+struct Inline<T>
+where
+    [u8; size_of::<T>() + 1]: ,
+{
+    _phantom: PhantomData<T>,
+    buf: [u8; size_of::<T>() + 1],
+}
+
+impl<T> Inline<T>
+where
+    [u8; size_of::<T>() + 1]: ,
+{
+    pub fn new(val: T) -> Inline<T> {
+        todo!()
+    }
+}
+
+fn main() {
+    let dst = Inline::<dyn Debug>::new(0); //~ ERROR
+    //~^ ERROR
+}