Skip to content

Commit 17a0b8b

Browse files
authored
Merge pull request #1869 from joshtriplett/fix-copy-clone-no-derive
2 parents 6bd95e4 + 6b52ae1 commit 17a0b8b

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

ci/style.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ fn check_style(file: &str, path: &Path, err: &mut Errors) {
134134
instead of #[cfg]");
135135
}
136136
}
137+
if line.contains("#[derive(") && (line.contains("Copy") || line.contains("Clone")) {
138+
err.error(path, i, "impl ::Copy and ::Clone manually");
139+
}
137140

138141
let line = line.trim_start();
139142
let is_pub = line.starts_with("pub ");

src/unix/linux_like/linux/gnu/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,14 +317,19 @@ cfg_if! {
317317
if #[cfg(libc_union)] {
318318
// Internal, for casts to access union fields
319319
#[repr(C)]
320-
#[derive(Copy,Clone)]
321320
struct sifields_sigchld {
322321
si_pid: ::pid_t,
323322
si_uid: ::uid_t,
324323
si_status: ::c_int,
325324
si_utime: ::c_long,
326325
si_stime: ::c_long,
327326
}
327+
impl ::Copy for sifields_sigchld {}
328+
impl ::Clone for sifields_sigchld {
329+
fn clone(&self) -> sifields_sigchld {
330+
*self
331+
}
332+
}
328333

329334
// Internal, for casts to access union fields
330335
#[repr(C)]

0 commit comments

Comments
 (0)