Sign in
android
/
toolchain
/
rustc
/
43f0694b1feb1296004d84509e01177159e71be0
/
.
/
src
/
test
/
ui
/
union
/
union-trait-impl.rs
blob: 8a7ac81724040cd4d2d2279a3a43abf24a10ed96 [
file
] [
log
] [
blame
]
// run-pass
use
std
::
fmt
;
union U
{
a
:
u8
}
impl
fmt
::
Display
for
U
{
fn
fmt
(&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
unsafe
{
write
!(
f
,
"Oh hai {}"
,
self
.
a
)
}
}
}
fn
main
()
{
assert_eq
!(
U
{
a
:
2
}.
to_string
(),
"Oh hai 2"
);
}