diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-12-09 22:31:54 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-09 22:31:54 +0100 |
| commit | 4fae5891d0857f9bfb0abbca9529e016c8a90ee6 (patch) | |
| tree | c63fffd8104a324d084ac7c8c6943faa55876257 /src/test | |
| parent | dfe3fe710181738a2cb3060c23ec5efb3c68ca09 (diff) | |
| parent | 34277fcddc41e924ffed7ddacb573d240854cff0 (diff) | |
| download | rust-4fae5891d0857f9bfb0abbca9529e016c8a90ee6.tar.gz rust-4fae5891d0857f9bfb0abbca9529e016c8a90ee6.zip | |
Rollup merge of #102406 - mejrs:missing_copy, r=wesleywiser
Make `missing_copy_implementations` more cautious - Fixes https://github.com/rust-lang/rust/issues/98348 - Also makes the lint not fire on large types and types containing raw pointers. Thoughts?
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/lint/lint-missing-copy-implementations-allow.rs | 35 |
1 files changed, 35 insertions, 0 deletions
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<Self::Item> { + 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() {} |
