Skip to content

Commit 9577058

Browse files
committed
Add a second regression test
1 parent 430c0d1 commit 9577058

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
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 numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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`.

0 commit comments

Comments
 (0)