about summary refs log tree commit diff
path: root/tests/ui/traits/const-traits/constructor-const-fn.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/traits/const-traits/constructor-const-fn.rs')
-rw-r--r--tests/ui/traits/const-traits/constructor-const-fn.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/traits/const-traits/constructor-const-fn.rs b/tests/ui/traits/const-traits/constructor-const-fn.rs
new file mode 100644
index 00000000000..4a7bf531df2
--- /dev/null
+++ b/tests/ui/traits/const-traits/constructor-const-fn.rs
@@ -0,0 +1,15 @@
+//@ check-pass
+//@ compile-flags: -Znext-solver
+#![feature(const_trait_impl)]
+const fn impls_fn<F: ~const Fn(u32) -> Foo>(_: &F) {}
+
+struct Foo(u32);
+
+const fn foo() {
+    // This previously triggered an incorrect assert
+    // when checking whether the constructor of `Foo`
+    // is const.
+    impls_fn(&Foo)
+}
+
+fn main() {}