File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
src/test/ui/const-generics Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ fn foo < const N : usize > ( ) -> [ u8 ; N ] {
2+ bar :: < N > ( ) //~ ERROR mismatched types
3+ }
4+
5+ fn bar < const N : u8 > ( ) -> [ u8 ; N ] { }
6+ //~^ ERROR mismatched types
7+ //~| ERROR mismatched types
8+
9+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error[E0308]: mismatched types
2+ --> $DIR/type_mismatch.rs:2:11
3+ |
4+ LL | bar::<N>()
5+ | ^ expected `u8`, found `usize`
6+
7+ error[E0308]: mismatched types
8+ --> $DIR/type_mismatch.rs:5:31
9+ |
10+ LL | fn bar<const N: u8>() -> [u8; N] {}
11+ | ^ expected `usize`, found `u8`
12+
13+ error[E0308]: mismatched types
14+ --> $DIR/type_mismatch.rs:5:26
15+ |
16+ LL | fn bar<const N: u8>() -> [u8; N] {}
17+ | --- ^^^^^^^ expected array `[u8; N]`, found `()`
18+ | |
19+ | implicitly returns `()` as its body has no tail or `return` expression
20+
21+ error: aborting due to 3 previous errors
22+
23+ For more information about this error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments