summaryrefslogtreecommitdiffstats
path: root/tests/ui/const-generics/defaults/doesnt_infer.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/const-generics/defaults/doesnt_infer.rs')
-rw-r--r--tests/ui/const-generics/defaults/doesnt_infer.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/ui/const-generics/defaults/doesnt_infer.rs b/tests/ui/const-generics/defaults/doesnt_infer.rs
new file mode 100644
index 000000000..9c59e672d
--- /dev/null
+++ b/tests/ui/const-generics/defaults/doesnt_infer.rs
@@ -0,0 +1,13 @@
+// test that defaulted const params are not used to help type inference
+
+struct Foo<const N: u32 = 2>;
+
+impl<const N: u32> Foo<N> {
+ fn foo() -> Self { loop {} }
+}
+
+fn main() {
+ let foo = Foo::<1>::foo();
+ let foo = Foo::foo();
+ //~^ error: type annotations needed for `Foo<N>`
+}