-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for deriving Debug for const generics
- Loading branch information
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#![feature(const_generics)] | ||
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash | ||
|
||
#[derive(Debug)] | ||
struct X<const N: usize> { | ||
a: [u32; N], //~ ERROR `[u32; _]` doesn't implement `std::fmt::Debug` | ||
} | ||
|
||
fn main() {} |
19 changes: 19 additions & 0 deletions
19
src/test/ui/const-generics/derive-debug-array-wrapper.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
warning: the feature `const_generics` is incomplete and may cause the compiler to crash | ||
--> $DIR/derive-debug-array-wrapper.rs:1:12 | ||
| | ||
LL | #![feature(const_generics)] | ||
| ^^^^^^^^^^^^^^ | ||
|
||
error[E0277]: `[u32; _]` doesn't implement `std::fmt::Debug` | ||
--> $DIR/derive-debug-array-wrapper.rs:6:5 | ||
| | ||
LL | a: [u32; N], | ||
| ^^^^^^^^^^^ `[u32; _]` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | ||
| | ||
= help: the trait `std::fmt::Debug` is not implemented for `[u32; _]` | ||
= note: required because of the requirements on the impl of `std::fmt::Debug` for `&[u32; _]` | ||
= note: required for the cast to the object type `dyn std::fmt::Debug` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |