File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed
src/test/ui/const-generics/issues Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ #![ feature( const_generics) ] //~ WARN the feature `const_generics` is incomplete
2+
3+ fn foo < const N : usize , const A : [ u8 ; N ] > ( ) { }
4+ //~^ ERROR the type of const parameters must not
5+
6+ fn main ( ) {
7+ foo :: < _ , { [ 1 ] } > ( ) ;
8+ //~^ ERROR wrong number of const arguments
9+ //~| ERROR wrong number of type arguments
10+ //~| ERROR mismatched types
11+ }
Original file line number Diff line number Diff line change 1+ error[E0770]: the type of const parameters must not depend on other generic parameters
2+ --> $DIR/issue-62878.rs:3:38
3+ |
4+ LL | fn foo<const N: usize, const A: [u8; N]>() {}
5+ | ^ the type must not depend on the parameter `N`
6+
7+ warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
8+ --> $DIR/issue-62878.rs:1:12
9+ |
10+ LL | #![feature(const_generics)]
11+ | ^^^^^^^^^^^^^^
12+ |
13+ = note: `#[warn(incomplete_features)]` on by default
14+ = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
15+
16+ error[E0107]: wrong number of const arguments: expected 2, found 1
17+ --> $DIR/issue-62878.rs:7:5
18+ |
19+ LL | foo::<_, {[1]}>();
20+ | ^^^^^^^^^^^^^^^ expected 2 const arguments
21+
22+ error[E0107]: wrong number of type arguments: expected 0, found 1
23+ --> $DIR/issue-62878.rs:7:11
24+ |
25+ LL | foo::<_, {[1]}>();
26+ | ^ unexpected type argument
27+
28+ error[E0308]: mismatched types
29+ --> $DIR/issue-62878.rs:7:15
30+ |
31+ LL | foo::<_, {[1]}>();
32+ | ^^^ expected `usize`, found array `[{integer}; 1]`
33+
34+ error: aborting due to 4 previous errors; 1 warning emitted
35+
36+ Some errors have detailed explanations: E0107, E0308, E0770.
37+ For more information about an error, try `rustc --explain E0107`.
You can’t perform that action at this time.
0 commit comments