Restrict use_self on nested items
This commit is contained in:
parent
c63b6349b4
commit
ff191a808e
2 changed files with 34 additions and 15 deletions
|
|
@ -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::*;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue