Skip to content

Commit 1369132

Browse files
varkoryodaldevoid
andcommitted
Add a test for const args that cannot be inferred
Co-Authored-By: Gabriel Smith <[email protected]>
1 parent a188850 commit 1369132

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#![feature(const_generics)]
2+
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
3+
4+
fn foo<const X: usize>() -> usize {
5+
0
6+
}
7+
8+
fn main() {
9+
foo(); //~ ERROR type annotations needed
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
2+
--> $DIR/cannot-infer-const-args.rs:1:12
3+
|
4+
LL | #![feature(const_generics)]
5+
| ^^^^^^^^^^^^^^
6+
7+
error[E0282]: type annotations needed
8+
--> $DIR/cannot-infer-const-args.rs:9:5
9+
|
10+
LL | foo();
11+
| ^^^ cannot infer type for `fn() -> usize {foo::<_>}`
12+
13+
error: aborting due to previous error
14+
15+
For more information about this error, try `rustc --explain E0282`.

0 commit comments

Comments
 (0)