]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/impl-trait-with-missing-bounds.rs
Rollup merge of #106766 - GuillaumeGomez:rm-stripper-dead-code, r=notriddle
[rust.git] / tests / ui / suggestions / impl-trait-with-missing-bounds.rs
1 // The double space in `impl  Iterator` is load bearing! We want to make sure we don't regress by
2 // accident if the internal string representation changes.
3 #[rustfmt::skip]
4 fn foo(constraints: impl  Iterator) {
5     for constraint in constraints {
6         qux(constraint);
7 //~^ ERROR `<impl Iterator as Iterator>::Item` doesn't implement `Debug`
8     }
9 }
10
11 fn bar<T>(t: T, constraints: impl Iterator) where T: std::fmt::Debug {
12     for constraint in constraints {
13         qux(t);
14         qux(constraint);
15 //~^ ERROR `<impl Iterator as Iterator>::Item` doesn't implement `Debug`
16     }
17 }
18
19 fn baz(t: impl std::fmt::Debug, constraints: impl Iterator) {
20     for constraint in constraints {
21         qux(t);
22         qux(constraint);
23 //~^ ERROR `<impl Iterator as Iterator>::Item` doesn't implement `Debug`
24     }
25 }
26
27 fn bat<I, T: std::fmt::Debug>(t: T, constraints: impl Iterator, _: I) {
28     for constraint in constraints {
29         qux(t);
30         qux(constraint);
31 //~^ ERROR `<impl Iterator as Iterator>::Item` doesn't implement `Debug`
32     }
33 }
34
35 fn bak(constraints: impl  Iterator + std::fmt::Debug) {
36     for constraint in constraints {
37         qux(constraint);
38 //~^ ERROR `<impl Iterator + std::fmt::Debug as Iterator>::Item` doesn't implement
39     }
40 }
41
42 #[rustfmt::skip]
43 fn baw<>(constraints: impl Iterator) {
44     for constraint in constraints {
45         qux(constraint);
46 //~^ ERROR `<impl Iterator as Iterator>::Item` doesn't implement `Debug`
47     }
48 }
49
50 fn qux(_: impl std::fmt::Debug) {}
51
52 fn main() {}