blob: c7acb08f84b6cdb7130e3d9f1369bca27b9451f9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
// 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`
}
|