summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/const-fn-not-in-trait.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/consts/const-fn-not-in-trait.rs')
-rw-r--r--src/test/ui/consts/const-fn-not-in-trait.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/ui/consts/const-fn-not-in-trait.rs b/src/test/ui/consts/const-fn-not-in-trait.rs
new file mode 100644
index 000000000..00bae3f3b
--- /dev/null
+++ b/src/test/ui/consts/const-fn-not-in-trait.rs
@@ -0,0 +1,13 @@
+// Test that const fn is illegal in a trait declaration, whether or
+// not a default is provided, and even with the feature gate.
+
+trait Foo {
+ const fn f() -> u32;
+ //~^ ERROR functions in traits cannot be declared const
+ const fn g() -> u32 {
+ //~^ ERROR functions in traits cannot be declared const
+ 0
+ }
+}
+
+fn main() {}