diff options
| author | Wilco Kusee <wilcokusee@gmail.com> | 2019-01-06 15:05:04 +0100 |
|---|---|---|
| committer | Wilco Kusee <wilcokusee@gmail.com> | 2019-01-06 15:34:36 +0100 |
| commit | ff191a808e563d36b4c8bedbd2a67aa44156faf9 (patch) | |
| tree | 98a65593155573f12b42a3de134817476a4f49c1 /tests | |
| parent | c63b6349b44019146cc2edcef8141692891b9401 (diff) | |
| download | rust-ff191a808e563d36b4c8bedbd2a67aa44156faf9.tar.gz rust-ff191a808e563d36b4c8bedbd2a67aa44156faf9.zip | |
Restrict use_self on nested items
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/use_self.rs | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/tests/ui/use_self.rs b/tests/ui/use_self.rs index a01cb3e7021..f3bd4a05005 100644 --- a/tests/ui/use_self.rs +++ b/tests/ui/use_self.rs @@ -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::*; - } - } -} |
