Skip to content

Commit 370e49a

Browse files
author
Tim Nielens
committed
rust-lang#3410: add missing false positive case in uitests
1 parent f6b07db commit 370e49a

File tree

3 files changed

+49
-13
lines changed

3 files changed

+49
-13
lines changed

tests/ui/use_self.fixed

+17-2
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,26 @@ mod issue3410 {
176176
struct B;
177177

178178
trait Trait<T> {
179-
fn a(v: T);
179+
fn a(v: T) -> Self;
180180
}
181181

182182
impl Trait<Vec<A>> for Vec<B> {
183-
fn a(_: Vec<A>) {}
183+
fn a(_: Vec<A>) -> Self {
184+
unimplemented!()
185+
}
186+
}
187+
188+
// FIXME
189+
impl<T> Trait<Vec<A>> for Vec<T>
190+
where
191+
T: Trait<B>,
192+
{
193+
fn a(v: Vec<A>) -> Self {
194+
<Self<B>>::a(v)
195+
.into_iter()
196+
.map(Trait::a)
197+
.collect()
198+
}
184199
}
185200
}
186201

tests/ui/use_self.rs

+17-2
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,26 @@ mod issue3410 {
176176
struct B;
177177

178178
trait Trait<T> {
179-
fn a(v: T);
179+
fn a(v: T) -> Self;
180180
}
181181

182182
impl Trait<Vec<A>> for Vec<B> {
183-
fn a(_: Vec<A>) {}
183+
fn a(_: Vec<A>) -> Self {
184+
unimplemented!()
185+
}
186+
}
187+
188+
// FIXME
189+
impl<T> Trait<Vec<A>> for Vec<T>
190+
where
191+
T: Trait<B>,
192+
{
193+
fn a(v: Vec<A>) -> Self {
194+
<Vec<B>>::a(v)
195+
.into_iter()
196+
.map(Trait::a)
197+
.collect()
198+
}
184199
}
185200
}
186201

tests/ui/use_self.stderr

+15-9
Original file line numberDiff line numberDiff line change
@@ -113,52 +113,58 @@ LL | let _ = Enum::A;
113113
| ^^^^ help: use the applicable keyword: `Self`
114114

115115
error: unnecessary structure name repetition
116-
--> $DIR/use_self.rs:199:13
116+
--> $DIR/use_self.rs:194:14
117+
|
118+
LL | <Vec<B>>::a(v)
119+
| ^^^ help: use the applicable keyword: `Self`
120+
121+
error: unnecessary structure name repetition
122+
--> $DIR/use_self.rs:214:13
117123
|
118124
LL | nested::A::fun_1();
119125
| ^^^^^^^^^ help: use the applicable keyword: `Self`
120126

121127
error: unnecessary structure name repetition
122-
--> $DIR/use_self.rs:200:13
128+
--> $DIR/use_self.rs:215:13
123129
|
124130
LL | nested::A::A;
125131
| ^^^^^^^^^ help: use the applicable keyword: `Self`
126132

127133
error: unnecessary structure name repetition
128-
--> $DIR/use_self.rs:202:13
134+
--> $DIR/use_self.rs:217:13
129135
|
130136
LL | nested::A {};
131137
| ^^^^^^^^^ help: use the applicable keyword: `Self`
132138

133139
error: unnecessary structure name repetition
134-
--> $DIR/use_self.rs:221:13
140+
--> $DIR/use_self.rs:236:13
135141
|
136142
LL | TestStruct::from_something()
137143
| ^^^^^^^^^^ help: use the applicable keyword: `Self`
138144

139145
error: unnecessary structure name repetition
140-
--> $DIR/use_self.rs:235:25
146+
--> $DIR/use_self.rs:250:25
141147
|
142148
LL | async fn g() -> S {
143149
| ^ help: use the applicable keyword: `Self`
144150

145151
error: unnecessary structure name repetition
146-
--> $DIR/use_self.rs:236:13
152+
--> $DIR/use_self.rs:251:13
147153
|
148154
LL | S {}
149155
| ^ help: use the applicable keyword: `Self`
150156

151157
error: unnecessary structure name repetition
152-
--> $DIR/use_self.rs:240:16
158+
--> $DIR/use_self.rs:255:16
153159
|
154160
LL | &p[S::A..S::B]
155161
| ^ help: use the applicable keyword: `Self`
156162

157163
error: unnecessary structure name repetition
158-
--> $DIR/use_self.rs:240:22
164+
--> $DIR/use_self.rs:255:22
159165
|
160166
LL | &p[S::A..S::B]
161167
| ^ help: use the applicable keyword: `Self`
162168

163-
error: aborting due to 25 previous errors
169+
error: aborting due to 26 previous errors
164170

0 commit comments

Comments
 (0)