Skip to content

Commit

Permalink
use_self - add test case of rust-lang#4734
Browse files Browse the repository at this point in the history
  • Loading branch information
tnielens committed Apr 29, 2020
1 parent 38d81f3 commit 77c4a1f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/ui/use_self.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -422,3 +422,18 @@ mod lint_at_impl_item_level {
}
}
}

mod issue4734 {
#[repr(C, packed)]
pub struct X {
pub x: u32,
}

impl From<X> for u32 {
fn from(c: X) -> Self {
unsafe {
core::mem::transmute(c)
}
}
}
}
15 changes: 15 additions & 0 deletions tests/ui/use_self.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,3 +422,18 @@ mod lint_at_impl_item_level {
}
}
}

mod issue4734 {
#[repr(C, packed)]
pub struct X {
pub x: u32,
}

impl From<X> for u32 {
fn from(c: X) -> Self {
unsafe {
core::mem::transmute(c)
}
}
}
}

0 comments on commit 77c4a1f

Please sign in to comment.