-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
missing_copy_implementations
more cautious
- Loading branch information
mejrs
committed
Sep 28, 2022
1 parent
837bf37
commit 1ccc2ab
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() {} |