diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/repeat-expr/infer.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/ui/repeat-expr/infer.rs b/src/test/ui/repeat-expr/infer.rs new file mode 100644 index 000000000..8197713b9 --- /dev/null +++ b/src/test/ui/repeat-expr/infer.rs @@ -0,0 +1,16 @@ +// check-pass + +#[derive(Clone, Default)] +struct MaybeCopy<T>(T); + +impl Copy for MaybeCopy<u8> {} + +fn is_copy<T: Copy>(x: T) { + println!("{}", std::any::type_name::<T>()); +} + +fn main() { + is_copy(MaybeCopy::default()); + [MaybeCopy::default(); 13]; + // didn't work, because `Copy` was only checked in the mir +} |