]> git.lizzy.rs Git - rust.git/blob - src/test/ui/associated-type-bounds/duplicate.rs
Rollup merge of #87307 - michaelwoerister:pgo-unwind-msvc, r=nagisa
[rust.git] / src / test / ui / associated-type-bounds / duplicate.rs
1 #![feature(associated_type_bounds)]
2 // revisions: min_tait full_tait
3 #![feature(min_type_alias_impl_trait)]
4 #![cfg_attr(full_tait, feature(type_alias_impl_trait))]
5 //[full_tait]~^ WARN incomplete
6 #![feature(untagged_unions)]
7
8 use std::iter;
9
10 struct SI1<T: Iterator<Item: Copy, Item: Send>> { f: T }
11 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
12 struct SI2<T: Iterator<Item: Copy, Item: Copy>> { f: T }
13 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
14 struct SI3<T: Iterator<Item: 'static, Item: 'static>> { f: T }
15 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
16 struct SW1<T> where T: Iterator<Item: Copy, Item: Send> { f: T }
17 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
18 struct SW2<T> where T: Iterator<Item: Copy, Item: Copy> { f: T }
19 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
20 struct SW3<T> where T: Iterator<Item: 'static, Item: 'static> { f: T }
21 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
22
23 enum EI1<T: Iterator<Item: Copy, Item: Send>> { V(T) }
24 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
25 enum EI2<T: Iterator<Item: Copy, Item: Copy>> { V(T) }
26 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
27 enum EI3<T: Iterator<Item: 'static, Item: 'static>> { V(T) }
28 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
29 enum EW1<T> where T: Iterator<Item: Copy, Item: Send> { V(T) }
30 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
31 enum EW2<T> where T: Iterator<Item: Copy, Item: Copy> { V(T) }
32 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
33 enum EW3<T> where T: Iterator<Item: 'static, Item: 'static> { V(T) }
34 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
35
36 union UI1<T: Iterator<Item: Copy, Item: Send>> { f: T }
37 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
38 union UI2<T: Iterator<Item: Copy, Item: Copy>> { f: T }
39 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
40 union UI3<T: Iterator<Item: 'static, Item: 'static>> { f: T }
41 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
42 union UW1<T> where T: Iterator<Item: Copy, Item: Send> { f: T }
43 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
44 union UW2<T> where T: Iterator<Item: Copy, Item: Copy> { f: T }
45 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
46 union UW3<T> where T: Iterator<Item: 'static, Item: 'static> { f: T }
47 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
48
49 fn FI1<T: Iterator<Item: Copy, Item: Send>>() {}
50 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
51 fn FI2<T: Iterator<Item: Copy, Item: Copy>>() {}
52 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
53 fn FI3<T: Iterator<Item: 'static, Item: 'static>>() {}
54 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
55 fn FW1<T>() where T: Iterator<Item: Copy, Item: Send> {}
56 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
57 fn FW2<T>() where T: Iterator<Item: Copy, Item: Copy> {}
58 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
59 fn FW3<T>() where T: Iterator<Item: 'static, Item: 'static> {}
60 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
61
62 fn FRPIT1() -> impl Iterator<Item: Copy, Item: Send> { iter::empty() }
63 fn FRPIT2() -> impl Iterator<Item: Copy, Item: Copy> { iter::empty() }
64 fn FRPIT3() -> impl Iterator<Item: 'static, Item: 'static> { iter::empty() }
65 fn FAPIT1(_: impl Iterator<Item: Copy, Item: Send>) {}
66 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
67 fn FAPIT2(_: impl Iterator<Item: Copy, Item: Copy>) {}
68 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
69 fn FAPIT3(_: impl Iterator<Item: 'static, Item: 'static>) {}
70 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
71
72 type TAI1<T: Iterator<Item: Copy, Item: Send>> = T;
73 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
74 type TAI2<T: Iterator<Item: Copy, Item: Copy>> = T;
75 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
76 type TAI3<T: Iterator<Item: 'static, Item: 'static>> = T;
77 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
78 type TAW1<T> where T: Iterator<Item: Copy, Item: Send> = T;
79 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
80 type TAW2<T> where T: Iterator<Item: Copy, Item: Copy> = T;
81 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
82 type TAW3<T> where T: Iterator<Item: 'static, Item: 'static> = T;
83 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
84
85 type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
86 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
87 type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
88 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
89 type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
90 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
91 type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
92 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
93 type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
94 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
95 type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
96 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
97
98 trait TRI1<T: Iterator<Item: Copy, Item: Send>> {}
99 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
100 trait TRI2<T: Iterator<Item: Copy, Item: Copy>> {}
101 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
102 trait TRI3<T: Iterator<Item: 'static, Item: 'static>> {}
103 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
104 trait TRS1: Iterator<Item: Copy, Item: Send> {}
105 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
106 trait TRS2: Iterator<Item: Copy, Item: Copy> {}
107 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
108 trait TRS3: Iterator<Item: 'static, Item: 'static> {}
109 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
110 trait TRW1<T> where T: Iterator<Item: Copy, Item: Send> {}
111 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
112 trait TRW2<T> where T: Iterator<Item: Copy, Item: Copy> {}
113 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
114 trait TRW3<T> where T: Iterator<Item: 'static, Item: 'static> {}
115 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
116 trait TRSW1 where Self: Iterator<Item: Copy, Item: Send> {}
117 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
118 //~| ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
119 trait TRSW2 where Self: Iterator<Item: Copy, Item: Copy> {}
120 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
121 //~| ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
122 trait TRSW3 where Self: Iterator<Item: 'static, Item: 'static> {}
123 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
124 //~| ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
125 trait TRA1 { type A: Iterator<Item: Copy, Item: Send>; }
126 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
127 trait TRA2 { type A: Iterator<Item: Copy, Item: Copy>; }
128 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
129 trait TRA3 { type A: Iterator<Item: 'static, Item: 'static>; }
130 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
131
132 type TADyn1 = dyn Iterator<Item: Copy, Item: Send>;
133 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
134 type TADyn2 = Box<dyn Iterator<Item: Copy, Item: Copy>>;
135 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
136 type TADyn3 = dyn Iterator<Item: 'static, Item: 'static>;
137 //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
138
139 fn main() {}