]> git.lizzy.rs Git - rust.git/blob - tests/ui/new-impl-syntax.rs
Rollup merge of #105526 - Xiretza:iter-from-generator-derive, r=scottmcm
[rust.git] / tests / ui / new-impl-syntax.rs
1 // run-pass
2
3 use std::fmt;
4
5 struct Thingy {
6     x: isize,
7     y: isize
8 }
9
10 impl fmt::Debug for Thingy {
11     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
12         write!(f, "{{ x: {:?}, y: {:?} }}", self.x, self.y)
13     }
14 }
15
16 struct PolymorphicThingy<T> {
17     x: T
18 }
19
20 impl<T:fmt::Debug> fmt::Debug for PolymorphicThingy<T> {
21     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
22         write!(f, "{:?}", self.x)
23     }
24 }
25
26 pub fn main() {
27     println!("{:?}", Thingy { x: 1, y: 2 });
28     println!("{:?}", PolymorphicThingy { x: Thingy { x: 1, y: 2 } });
29 }