mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
23 lines
665 B
Rust
23 lines
665 B
Rust
// check-compile
|
|
|
|
struct DisplayOnly;
|
|
|
|
impl std::fmt::Display for DisplayOnly {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
unimplemented!()
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
let x = Some(1);
|
|
println!("{x:?} {x} {x:?}");
|
|
//~^ ERROR: `Option<{integer}>` doesn't implement `std::fmt::Display`
|
|
println!("{x:?} {x} {x:?}", x = Some(1));
|
|
//~^ ERROR: `Option<{integer}>` doesn't implement `std::fmt::Display`
|
|
let x = DisplayOnly;
|
|
println!("{x} {x:?} {x}");
|
|
//~^ ERROR: `DisplayOnly` doesn't implement `Debug`
|
|
println!("{x} {x:?} {x}", x = DisplayOnly);
|
|
//~^ ERROR: `DisplayOnly` doesn't implement `Debug`
|
|
}
|