]> git.lizzy.rs Git - rust.git/blob - tests/ui/derives/derive-Debug-use-ufcs-struct.rs
Rollup merge of #106732 - durin42:dmitrig-arrayref-ctor, r=nikic
[rust.git] / tests / ui / derives / derive-Debug-use-ufcs-struct.rs
1 // run-pass
2 #![allow(warnings)]
3
4 #[derive(Debug)]
5 pub struct Bar { pub t: () }
6
7 impl<T> Access for T {}
8 pub trait Access {
9     fn field(&self, _: impl Sized, _: impl Sized) {
10         panic!("got into Access::field");
11     }
12
13     fn finish(&self) -> Result<(), std::fmt::Error> {
14         panic!("got into Access::finish");
15     }
16
17     fn debug_struct(&self, _: impl Sized, _: impl Sized) {
18         panic!("got into Access::debug_struct");
19     }
20 }
21
22 impl<T> MutAccess for T {}
23 pub trait MutAccess {
24     fn field(&mut self, _: impl Sized, _: impl Sized) {
25         panic!("got into MutAccess::field");
26     }
27
28     fn finish(&mut self) -> Result<(), std::fmt::Error> {
29         panic!("got into MutAccess::finish");
30     }
31
32     fn debug_struct(&mut self, _: impl Sized, _: impl Sized) {
33         panic!("got into MutAccess::debug_struct");
34     }
35 }
36
37 fn main() {
38     let bar = Bar { t: () };
39     assert_eq!("Bar { t: () }", format!("{:?}", bar));
40 }