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?
This commit is contained in:
commit
4fae5891d0
2 changed files with 66 additions and 1 deletions
35
src/test/ui/lint/lint-missing-copy-implementations-allow.rs
Normal file
35
src/test/ui/lint/lint-missing-copy-implementations-allow.rs
Normal file
|
|
@ -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() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue