Restrict use_self on nested items

This commit is contained in:
Wilco Kusee 2019-01-06 15:05:04 +01:00
parent c63b6349b4
commit ff191a808e
2 changed files with 34 additions and 15 deletions

View file

@ -242,6 +242,28 @@ mod macros {
}
}
mod nesting {
struct Foo {}
impl Foo {
fn foo() {
use self::Foo; // Can't use Self here
struct Bar {
foo: Foo, // Foo != Self
}
}
}
enum Enum {
A,
}
impl Enum {
fn method() {
use self::Enum::*;
static STATIC: Enum = Enum::A; // Can't use Self as type
}
}
}
mod issue3410 {
struct A;
@ -255,14 +277,3 @@ mod issue3410 {
fn a(_: Vec<A>) {}
}
}
mod issue3425 {
enum Enum {
A,
}
impl Enum {
fn a() {
use self::Enum::*;
}
}
}