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