summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/const-needs_drop-monomorphic.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/consts/const-needs_drop-monomorphic.rs')
-rw-r--r--src/test/ui/consts/const-needs_drop-monomorphic.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/ui/consts/const-needs_drop-monomorphic.rs b/src/test/ui/consts/const-needs_drop-monomorphic.rs
new file mode 100644
index 000000000..7402c6809
--- /dev/null
+++ b/src/test/ui/consts/const-needs_drop-monomorphic.rs
@@ -0,0 +1,17 @@
+// Check that evaluation of needs_drop<T> fails when T is not monomorphic.
+#![feature(generic_const_exprs)]
+#![allow(const_evaluatable_unchecked)]
+#![allow(incomplete_features)]
+
+struct Bool<const B: bool> {}
+impl Bool<true> {
+ fn assert() {}
+}
+fn f<T>() {
+ Bool::<{ std::mem::needs_drop::<T>() }>::assert();
+ //~^ ERROR no function or associated item named `assert` found
+ //~| ERROR unconstrained generic constant
+}
+fn main() {
+ f::<u32>();
+}