forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#102406 - mejrs:missing_copy, r=wesleywiser
Make `missing_copy_implementations` more cautious - Fixes rust-lang#98348 - Also makes the lint not fire on large types and types containing raw pointers. Thoughts?
- Loading branch information
Showing
2 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/test/ui/lint/lint-missing-copy-implementations-allow.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |