Skip to content

Commit

Permalink
rust-lang#3410: add missing false positive case in uitests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Nielens committed Apr 22, 2020
1 parent 1d4dd3d commit be47b7a
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 13 deletions.
19 changes: 17 additions & 2 deletions tests/ui/use_self.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,26 @@ mod issue3410 {
struct B;

trait Trait<T> {
fn a(v: T);
fn a(v: T) -> Self;
}

impl Trait<Vec<A>> for Vec<B> {
fn a(_: Vec<A>) {}
fn a(_: Vec<A>) -> Self {
unimplemented!()
}
}

// FIXME
impl<T> Trait<Vec<A>> for Vec<T>
where
T: Trait<B>,
{
fn a(v: Vec<A>) -> Self {
<Self<B>>::a(v)
.into_iter()
.map(Trait::a)
.collect()
}
}
}

Expand Down
19 changes: 17 additions & 2 deletions tests/ui/use_self.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,26 @@ mod issue3410 {
struct B;

trait Trait<T> {
fn a(v: T);
fn a(v: T) -> Self;
}

impl Trait<Vec<A>> for Vec<B> {
fn a(_: Vec<A>) {}
fn a(_: Vec<A>) -> Self {
unimplemented!()
}
}

// FIXME
impl<T> Trait<Vec<A>> for Vec<T>
where
T: Trait<B>,
{
fn a(v: Vec<A>) -> Self {
<Vec<B>>::a(v)
.into_iter()
.map(Trait::a)
.collect()
}
}
}

Expand Down
24 changes: 15 additions & 9 deletions tests/ui/use_self.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -113,52 +113,58 @@ LL | let _ = Enum::A;
| ^^^^ help: use the applicable keyword: `Self`

error: unnecessary structure name repetition
--> $DIR/use_self.rs:199:13
--> $DIR/use_self.rs:194:14
|
LL | <Vec<B>>::a(v)
| ^^^ help: use the applicable keyword: `Self`

error: unnecessary structure name repetition
--> $DIR/use_self.rs:214:13
|
LL | nested::A::fun_1();
| ^^^^^^^^^ help: use the applicable keyword: `Self`

error: unnecessary structure name repetition
--> $DIR/use_self.rs:200:13
--> $DIR/use_self.rs:215:13
|
LL | nested::A::A;
| ^^^^^^^^^ help: use the applicable keyword: `Self`

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

error: unnecessary structure name repetition
--> $DIR/use_self.rs:221:13
--> $DIR/use_self.rs:236:13
|
LL | TestStruct::from_something()
| ^^^^^^^^^^ help: use the applicable keyword: `Self`

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

error: unnecessary structure name repetition
--> $DIR/use_self.rs:236:13
--> $DIR/use_self.rs:251:13
|
LL | S {}
| ^ help: use the applicable keyword: `Self`

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

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

error: aborting due to 25 previous errors
error: aborting due to 26 previous errors

0 comments on commit be47b7a

Please sign in to comment.