Skip to content

Commit a7a2bc7

Browse files
committed
use_self - add test case of #4734
1 parent 38d81f3 commit a7a2bc7

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

tests/ui/use_self.fixed

+13
Original file line numberDiff line numberDiff line change
@@ -422,3 +422,16 @@ mod lint_at_impl_item_level {
422422
}
423423
}
424424
}
425+
426+
mod issue4734 {
427+
#[repr(C, packed)]
428+
pub struct X {
429+
pub x: u32,
430+
}
431+
432+
impl From<X> for u32 {
433+
fn from(c: X) -> Self {
434+
unsafe { core::mem::transmute(c) }
435+
}
436+
}
437+
}

tests/ui/use_self.rs

+13
Original file line numberDiff line numberDiff line change
@@ -422,3 +422,16 @@ mod lint_at_impl_item_level {
422422
}
423423
}
424424
}
425+
426+
mod issue4734 {
427+
#[repr(C, packed)]
428+
pub struct X {
429+
pub x: u32,
430+
}
431+
432+
impl From<X> for u32 {
433+
fn from(c: X) -> Self {
434+
unsafe { core::mem::transmute(c) }
435+
}
436+
}
437+
}

0 commit comments

Comments
 (0)