about summary refs log tree commit diff
path: root/tests/ui/generic-const-items
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-02-22 09:35:33 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-03-19 17:30:08 +0000
commit3ec5042cf944cfb242408e45166e7da79eaf0692 (patch)
tree0b76c4007ed0a80b17921e6a462fd9cc56303a78 /tests/ui/generic-const-items
parent200e3f7995e231535fdea3be9cb9a3f098b4c856 (diff)
downloadrust-3ec5042cf944cfb242408e45166e7da79eaf0692.tar.gz
rust-3ec5042cf944cfb242408e45166e7da79eaf0692.zip
Avoid computing generic params or a param env for free const items
Diffstat (limited to 'tests/ui/generic-const-items')
-rw-r--r--tests/ui/generic-const-items/hkl_where_bounds.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/ui/generic-const-items/hkl_where_bounds.rs b/tests/ui/generic-const-items/hkl_where_bounds.rs
new file mode 100644
index 00000000000..cded518312a
--- /dev/null
+++ b/tests/ui/generic-const-items/hkl_where_bounds.rs
@@ -0,0 +1,14 @@
+//! Test that nonsense bounds prevent consts from being evaluated at all.
+//@ check-pass
+
+#![feature(generic_const_items)]
+#![allow(incomplete_features)]
+trait Trait {
+    const ASSOC: u32;
+}
+
+// rustfmt eats the where bound
+#[rustfmt::skip]
+const ASSOC: u32 = <&'static ()>::ASSOC where for<'a> &'a (): Trait;
+
+fn main() {}