about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorBoxy <supbscripter@gmail.com>2022-12-12 14:28:08 +0000
committerBoxy <supbscripter@gmail.com>2022-12-12 14:30:01 +0000
commitdd19656df3d76d3733243ea83b692cacdd7512a5 (patch)
tree642f3c9d0a456491bde29b2afb32e0096517f208 /src
parent37d7de337903a558dbeb1e82c844fe915ab8ff25 (diff)
fold instead of obliterating args
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/const-generics/generic_const_exprs/issue-105608.rs15
-rw-r--r--src/test/ui/const-generics/generic_const_exprs/issue-105608.stderr14
2 files changed, 29 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-105608.rs b/src/test/ui/const-generics/generic_const_exprs/issue-105608.rs
new file mode 100644
index 00000000000..4c85abd5c1e
--- /dev/null
+++ b/src/test/ui/const-generics/generic_const_exprs/issue-105608.rs
@@ -0,0 +1,15 @@
+#![allow(incomplete_features, unstable_features)]
+#![feature(generic_const_exprs)]
+
+struct Combination<const STRATEGIES: usize>;
+
+impl<const STRATEGIES: usize> Combination<STRATEGIES> {
+    fn and<M>(self) -> Combination<{ STRATEGIES + 1 }> {
+        Combination
+    }
+}
+
+pub fn main() {
+    Combination::<0>.and::<_>().and::<_>();
+    //~^ ERROR: type annotations needed
+}
diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-105608.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-105608.stderr
new file mode 100644
index 00000000000..0be4c43daac
--- /dev/null
+++ b/src/test/ui/const-generics/generic_const_exprs/issue-105608.stderr
@@ -0,0 +1,14 @@
+error[E0282]: type annotations needed
+  --> $DIR/issue-105608.rs:13:22
+   |
+LL |     Combination::<0>.and::<_>().and::<_>();
+   |                      ^^^ cannot infer type of the type parameter `M` declared on the associated function `and`
+   |
+help: consider specifying the generic argument
+   |
+LL |     Combination::<0>.and::<_>().and::<_>();
+   |                         ~~~~~
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.