rust/tests/ui/union/union-trait-impl.rs
Matthew Jasper 982b49494e Remove revisions for THIR unsafeck
This is to make the diff when stabilizing it easier to review.
2024-01-05 09:30:27 +00:00

18 lines
261 B
Rust

// 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");
}