diff options
Diffstat (limited to 'src/test/ui/const-generics/uninferred-consts-during-codegen-1.rs')
-rw-r--r-- | src/test/ui/const-generics/uninferred-consts-during-codegen-1.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/uninferred-consts-during-codegen-1.rs b/src/test/ui/const-generics/uninferred-consts-during-codegen-1.rs new file mode 100644 index 000000000..c7270e835 --- /dev/null +++ b/src/test/ui/const-generics/uninferred-consts-during-codegen-1.rs @@ -0,0 +1,15 @@ +// run-pass + +use std::fmt; + +struct Array<T, const N: usize>([T; N]); + +impl<T: fmt::Debug, const N: usize> fmt::Debug for Array<T, N> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_list().entries(self.0.iter()).finish() + } +} + +fn main() { + assert_eq!(format!("{:?}", Array([1, 2, 3])), "[1, 2, 3]"); +} |