From 4ced370f7c03dad99c74ceb4b86a0538b970690a Mon Sep 17 00:00:00 2001 From: mejrs <> Date: Wed, 28 Sep 2022 15:11:27 +0200 Subject: Make `missing_copy_implementations` more cautious --- .../lint-missing-copy-implementations-allow.rs | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/test/ui/lint/lint-missing-copy-implementations-allow.rs (limited to 'src') diff --git a/src/test/ui/lint/lint-missing-copy-implementations-allow.rs b/src/test/ui/lint/lint-missing-copy-implementations-allow.rs new file mode 100644 index 00000000000..051a905aed6 --- /dev/null +++ b/src/test/ui/lint/lint-missing-copy-implementations-allow.rs @@ -0,0 +1,35 @@ +// check-pass +#![deny(missing_copy_implementations)] + +// Don't recommend implementing Copy on something stateful like an iterator. +pub struct MyIterator { + num: u8, +} + +impl Iterator for MyIterator { + type Item = u8; + + fn next(&mut self) -> Option { + todo!() + } +} + +pub struct Handle { + inner: *mut (), +} + +pub struct Handle2 { + inner: *const (), +} + +pub enum MaybeHandle { + Ptr(*mut ()), +} + +pub union UnionHandle { + ptr: *mut (), +} + +pub struct Array([u8; 2048]); + +fn main() {} -- cgit 1.4.1-3-g733a5