summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/const-eval/size-of-t.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/consts/const-eval/size-of-t.rs')
-rw-r--r--src/test/ui/consts/const-eval/size-of-t.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/ui/consts/const-eval/size-of-t.rs b/src/test/ui/consts/const-eval/size-of-t.rs
new file mode 100644
index 000000000..efbdeec70
--- /dev/null
+++ b/src/test/ui/consts/const-eval/size-of-t.rs
@@ -0,0 +1,13 @@
+// https://github.com/rust-lang/rust/issues/69228
+// Used to give bogus suggestion about T not being Sized.
+
+use std::mem::size_of;
+
+fn foo<T>() {
+ let _arr: [u8; size_of::<T>()];
+ //~^ ERROR generic parameters may not be used in const operations
+ //~| NOTE cannot perform const operation
+ //~| NOTE type parameters may not be used in const expressions
+}
+
+fn main() {}