Skip to content

Commit 7bb0a16

Browse files
committed
Add test for deriving Debug for const generics
1 parent 647b4a4 commit 7bb0a16

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#![feature(const_generics)]
2+
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
3+
4+
#[derive(Debug)]
5+
struct X<const N: usize> {
6+
a: [u32; N], //~ ERROR `[u32; _]` doesn't implement `std::fmt::Debug`
7+
}
8+
9+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
2+
--> $DIR/derive-debug-array-wrapper.rs:1:12
3+
|
4+
LL | #![feature(const_generics)]
5+
| ^^^^^^^^^^^^^^
6+
7+
error[E0277]: `[u32; _]` doesn't implement `std::fmt::Debug`
8+
--> $DIR/derive-debug-array-wrapper.rs:6:5
9+
|
10+
LL | a: [u32; N],
11+
| ^^^^^^^^^^^ `[u32; _]` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
12+
|
13+
= help: the trait `std::fmt::Debug` is not implemented for `[u32; _]`
14+
= note: required because of the requirements on the impl of `std::fmt::Debug` for `&[u32; _]`
15+
= note: required for the cast to the object type `dyn std::fmt::Debug`
16+
17+
error: aborting due to previous error
18+
19+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)