]> git.proxmox.com Git - rustc.git/blame - src/test/ui/associated-type-bounds/duplicate.rs
New upstream version 1.43.0+dfsg1
[rustc.git] / src / test / ui / associated-type-bounds / duplicate.rs
CommitLineData
dc9dc135 1// ignore-tidy-linelength
dc9dc135
XL
2
3#![feature(associated_type_bounds)]
416331ca 4#![feature(type_alias_impl_trait)]
e1599b0c 5#![feature(impl_trait_in_bindings)] //~ WARN the feature `impl_trait_in_bindings` is incomplete and may cause the compiler to crash [incomplete_features]
dc9dc135
XL
6#![feature(untagged_unions)]
7
8use std::iter;
9
10struct SI1<T: Iterator<Item: Copy, Item: Send>> { f: T }
dfeec247 11//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 12struct SI2<T: Iterator<Item: Copy, Item: Copy>> { f: T }
dfeec247 13//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 14struct SI3<T: Iterator<Item: 'static, Item: 'static>> { f: T }
dfeec247 15//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 16struct SW1<T> where T: Iterator<Item: Copy, Item: Send> { f: T }
dfeec247 17//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 18struct SW2<T> where T: Iterator<Item: Copy, Item: Copy> { f: T }
dfeec247 19//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 20struct SW3<T> where T: Iterator<Item: 'static, Item: 'static> { f: T }
dfeec247 21//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135
XL
22
23enum EI1<T: Iterator<Item: Copy, Item: Send>> { V(T) }
dfeec247 24//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 25enum EI2<T: Iterator<Item: Copy, Item: Copy>> { V(T) }
dfeec247 26//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 27enum EI3<T: Iterator<Item: 'static, Item: 'static>> { V(T) }
dfeec247 28//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 29enum EW1<T> where T: Iterator<Item: Copy, Item: Send> { V(T) }
dfeec247 30//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 31enum EW2<T> where T: Iterator<Item: Copy, Item: Copy> { V(T) }
dfeec247 32//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 33enum EW3<T> where T: Iterator<Item: 'static, Item: 'static> { V(T) }
dfeec247 34//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135
XL
35
36union UI1<T: Iterator<Item: Copy, Item: Send>> { f: T }
dfeec247 37//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 38union UI2<T: Iterator<Item: Copy, Item: Copy>> { f: T }
dfeec247 39//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 40union UI3<T: Iterator<Item: 'static, Item: 'static>> { f: T }
dfeec247 41//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 42union UW1<T> where T: Iterator<Item: Copy, Item: Send> { f: T }
dfeec247 43//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 44union UW2<T> where T: Iterator<Item: Copy, Item: Copy> { f: T }
dfeec247 45//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 46union UW3<T> where T: Iterator<Item: 'static, Item: 'static> { f: T }
dfeec247 47//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135
XL
48
49fn FI1<T: Iterator<Item: Copy, Item: Send>>() {}
dfeec247 50//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 51fn FI2<T: Iterator<Item: Copy, Item: Copy>>() {}
dfeec247 52//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 53fn FI3<T: Iterator<Item: 'static, Item: 'static>>() {}
dfeec247 54//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 55fn FW1<T>() where T: Iterator<Item: Copy, Item: Send> {}
dfeec247 56//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 57fn FW2<T>() where T: Iterator<Item: Copy, Item: Copy> {}
dfeec247 58//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 59fn FW3<T>() where T: Iterator<Item: 'static, Item: 'static> {}
dfeec247 60//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135
XL
61
62fn FRPIT1() -> impl Iterator<Item: Copy, Item: Send> { iter::empty() }
dfeec247 63//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 64fn FRPIT2() -> impl Iterator<Item: Copy, Item: Copy> { iter::empty() }
dfeec247 65//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 66fn FRPIT3() -> impl Iterator<Item: 'static, Item: 'static> { iter::empty() }
dfeec247 67//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 68fn FAPIT1(_: impl Iterator<Item: Copy, Item: Send>) {}
dfeec247 69//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 70fn FAPIT2(_: impl Iterator<Item: Copy, Item: Copy>) {}
dfeec247 71//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 72fn FAPIT3(_: impl Iterator<Item: 'static, Item: 'static>) {}
dfeec247 73//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135
XL
74
75const CIT1: impl Iterator<Item: Copy, Item: Send> = iter::empty();
dfeec247 76//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 77const CIT2: impl Iterator<Item: Copy, Item: Copy> = iter::empty();
dfeec247 78//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 79const CIT3: impl Iterator<Item: 'static, Item: 'static> = iter::empty();
dfeec247 80//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 81static SIT1: impl Iterator<Item: Copy, Item: Send> = iter::empty();
dfeec247 82//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 83static SIT2: impl Iterator<Item: Copy, Item: Copy> = iter::empty();
dfeec247 84//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 85static SIT3: impl Iterator<Item: 'static, Item: 'static> = iter::empty();
dfeec247 86//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135
XL
87
88fn lit1() { let _: impl Iterator<Item: Copy, Item: Send> = iter::empty(); }
dfeec247 89//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 90fn lit2() { let _: impl Iterator<Item: Copy, Item: Copy> = iter::empty(); }
dfeec247 91//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 92fn lit3() { let _: impl Iterator<Item: 'static, Item: 'static> = iter::empty(); }
dfeec247 93//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135
XL
94
95type TAI1<T: Iterator<Item: Copy, Item: Send>> = T;
dfeec247 96//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 97type TAI2<T: Iterator<Item: Copy, Item: Copy>> = T;
dfeec247 98//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 99type TAI3<T: Iterator<Item: 'static, Item: 'static>> = T;
dfeec247 100//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 101type TAW1<T> where T: Iterator<Item: Copy, Item: Send> = T;
dfeec247 102//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 103type TAW2<T> where T: Iterator<Item: Copy, Item: Copy> = T;
dfeec247 104//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 105type TAW3<T> where T: Iterator<Item: 'static, Item: 'static> = T;
dfeec247 106//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 107
416331ca 108type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
dfeec247 109//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
e1599b0c
XL
110//~| ERROR could not find defining uses
111//~| ERROR could not find defining uses
112//~| ERROR could not find defining uses
416331ca 113type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
dfeec247 114//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
e1599b0c
XL
115//~| ERROR could not find defining uses
116//~| ERROR could not find defining uses
117//~| ERROR could not find defining uses
416331ca 118type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
dfeec247 119//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
e1599b0c
XL
120//~| ERROR could not find defining uses
121//~| ERROR could not find defining uses
122//~| ERROR could not find defining uses
416331ca 123type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
dfeec247 124//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
e1599b0c
XL
125//~| ERROR could not find defining uses
126//~| ERROR could not find defining uses
127//~| ERROR could not find defining uses
416331ca 128type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
dfeec247 129//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
e1599b0c
XL
130//~| ERROR could not find defining uses
131//~| ERROR could not find defining uses
132//~| ERROR could not find defining uses
416331ca 133type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
dfeec247 134//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
e1599b0c
XL
135//~| ERROR could not find defining uses
136//~| ERROR could not find defining uses
137//~| ERROR could not find defining uses
dc9dc135
XL
138
139trait TRI1<T: Iterator<Item: Copy, Item: Send>> {}
dfeec247 140//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 141trait TRI2<T: Iterator<Item: Copy, Item: Copy>> {}
dfeec247 142//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 143trait TRI3<T: Iterator<Item: 'static, Item: 'static>> {}
dfeec247 144//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 145trait TRS1: Iterator<Item: Copy, Item: Send> {}
dfeec247 146//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 147trait TRS2: Iterator<Item: Copy, Item: Copy> {}
dfeec247 148//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 149trait TRS3: Iterator<Item: 'static, Item: 'static> {}
dfeec247 150//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 151trait TRW1<T> where T: Iterator<Item: Copy, Item: Send> {}
dfeec247 152//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 153trait TRW2<T> where T: Iterator<Item: Copy, Item: Copy> {}
dfeec247 154//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 155trait TRW3<T> where T: Iterator<Item: 'static, Item: 'static> {}
dfeec247 156//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 157trait TRSW1 where Self: Iterator<Item: Copy, Item: Send> {}
dfeec247
XL
158//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
159//~| ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 160trait TRSW2 where Self: Iterator<Item: Copy, Item: Copy> {}
dfeec247
XL
161//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
162//~| ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 163trait TRSW3 where Self: Iterator<Item: 'static, Item: 'static> {}
dfeec247
XL
164//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
165//~| ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 166trait TRA1 { type A: Iterator<Item: Copy, Item: Send>; }
dfeec247 167//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 168trait TRA2 { type A: Iterator<Item: Copy, Item: Copy>; }
dfeec247 169//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135 170trait TRA3 { type A: Iterator<Item: 'static, Item: 'static>; }
dfeec247 171//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
dc9dc135
XL
172
173type TADyn1 = dyn Iterator<Item: Copy, Item: Send>;
dfeec247 174//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
e1599b0c
XL
175//~| ERROR could not find defining uses
176//~| ERROR could not find defining uses
dc9dc135 177type TADyn2 = Box<dyn Iterator<Item: Copy, Item: Copy>>;
dfeec247 178//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
e1599b0c
XL
179//~| ERROR could not find defining uses
180//~| ERROR could not find defining uses
dc9dc135 181type TADyn3 = dyn Iterator<Item: 'static, Item: 'static>;
dfeec247 182//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
e1599b0c
XL
183//~| ERROR could not find defining uses
184//~| ERROR could not find defining uses
dc9dc135
XL
185
186fn main() {}