Skip to content

Commit f817cd1

Browse files
authored
Rollup merge of #120107 - shepmaster:dead-code-repr-transparent, r=Nilstrieb
dead_code treats #[repr(transparent)] the same as #[repr(C)] In #92972 we enabled linting on unused fields in tuple structs. In #118297 that lint was enabled by default. That exposed issues like #119659, where the fields of a struct marked `#[repr(transparent)]` were reported by the `dead_code` lint. The language team [decided](rust-lang/rust#119659 (comment)) that the lint should treat `repr(transparent)` the same as `#[repr(C)]`. Fixes #119659
2 parents 841f1b7 + dd12f3a commit f817cd1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

tests/fail/issue-miri-1112.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
trait Empty {}
22

33
#[repr(transparent)]
4-
pub struct FunnyPointer(#[allow(dead_code)] dyn Empty);
4+
pub struct FunnyPointer(dyn Empty);
55

66
#[repr(C)]
77
pub struct Meta {

tests/fail/unaligned_pointers/drop_in_place.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@compile-flags: -Cdebug-assertions=no
22

33
#[repr(transparent)]
4-
struct HasDrop(#[allow(dead_code)] u8);
4+
struct HasDrop(u8);
55

66
impl Drop for HasDrop {
77
fn drop(&mut self) {}

0 commit comments

Comments
 (0)