Check existential types in use_self
This commit is contained in:
parent
4c6201dceb
commit
3db14f182c
@ -226,6 +226,6 @@ impl<'a, 'tcx> Visitor<'tcx> for UseSelfVisitor<'a, 'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||||
NestedVisitorMap::OnlyBodies(&self.cx.tcx.hir)
|
NestedVisitorMap::All(&self.cx.tcx.hir)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,3 +205,17 @@ mod issue2894 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mod existential {
|
||||||
|
struct Foo;
|
||||||
|
|
||||||
|
impl Foo {
|
||||||
|
fn bad(foos: &[Self]) -> impl Iterator<Item=&Foo> {
|
||||||
|
foos.iter()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn good(foos: &[Self]) -> impl Iterator<Item=&Self> {
|
||||||
|
foos.iter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -120,5 +120,11 @@ error: unnecessary structure name repetition
|
|||||||
119 | fn mul(self, rhs: Bad) -> Bad {
|
119 | fn mul(self, rhs: Bad) -> Bad {
|
||||||
| ^^^ help: use the applicable keyword: `Self`
|
| ^^^ help: use the applicable keyword: `Self`
|
||||||
|
|
||||||
error: aborting due to 20 previous errors
|
error: unnecessary structure name repetition
|
||||||
|
--> $DIR/use_self.rs:213:54
|
||||||
|
|
|
||||||
|
213 | fn bad(foos: &[Self]) -> impl Iterator<Item=&Foo> {
|
||||||
|
| ^^^ help: use the applicable keyword: `Self`
|
||||||
|
|
||||||
|
error: aborting due to 21 previous errors
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user