]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/derive-macro-missing-bounds.rs
Rollup merge of #106670 - albertlarsan68:check-docs-in-pr-ci, r=Mark-Simulacrum
[rust.git] / tests / ui / suggestions / derive-macro-missing-bounds.rs
1 mod a {
2     use std::fmt::{Debug, Formatter, Result};
3     struct Inner<T>(T);
4
5     impl Debug for Inner<()> {
6         fn fmt(&self, f: &mut Formatter<'_>) -> Result {
7             todo!()
8         }
9     }
10
11     #[derive(Debug)]
12     struct Outer<T>(Inner<T>); //~ ERROR `a::Inner<T>` doesn't implement `Debug`
13 }
14
15 mod b {
16     use std::fmt::{Debug, Formatter, Result};
17     struct Inner<T>(T);
18
19     impl<T: Debug> Debug for Inner<T> {
20         fn fmt(&self, f: &mut Formatter<'_>) -> Result {
21             todo!()
22         }
23     }
24
25     #[derive(Debug)]
26     struct Outer<T>(Inner<T>);
27 }
28
29 mod c {
30     use std::fmt::{Debug, Formatter, Result};
31     struct Inner<T>(T);
32     trait Trait {}
33
34     impl<T: Debug + Trait> Debug for Inner<T> {
35         fn fmt(&self, f: &mut Formatter<'_>) -> Result {
36             todo!()
37         }
38     }
39
40     #[derive(Debug)]
41     struct Outer<T>(Inner<T>); //~ ERROR the trait bound `T: c::Trait` is not satisfied
42 }
43
44 mod d {
45     use std::fmt::{Debug, Formatter, Result};
46     struct Inner<T>(T);
47     trait Trait {}
48
49     impl<T> Debug for Inner<T> where T: Debug, T: Trait {
50         fn fmt(&self, f: &mut Formatter<'_>) -> Result {
51             todo!()
52         }
53     }
54
55     #[derive(Debug)]
56     struct Outer<T>(Inner<T>); //~ ERROR the trait bound `T: d::Trait` is not satisfied
57 }
58
59 mod e {
60     use std::fmt::{Debug, Formatter, Result};
61     struct Inner<T>(T);
62     trait Trait {}
63
64     impl<T> Debug for Inner<T> where T: Debug + Trait {
65         fn fmt(&self, f: &mut Formatter<'_>) -> Result {
66             todo!()
67         }
68     }
69
70     #[derive(Debug)]
71     struct Outer<T>(Inner<T>); //~ ERROR the trait bound `T: e::Trait` is not satisfied
72 }
73
74 mod f {
75     use std::fmt::{Debug, Formatter, Result};
76     struct Inner<T>(T);
77     trait Trait {}
78
79     impl<T: Debug> Debug for Inner<T> where T: Trait {
80         fn fmt(&self, f: &mut Formatter<'_>) -> Result {
81             todo!()
82         }
83     }
84
85     #[derive(Debug)]
86     struct Outer<T>(Inner<T>); //~ ERROR the trait bound `T: f::Trait` is not satisfied
87 }
88
89 fn main() {}