about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorWilco Kusee <wilcokusee@gmail.com>2019-01-06 15:05:04 +0100
committerWilco Kusee <wilcokusee@gmail.com>2019-01-06 15:34:36 +0100
commitff191a808e563d36b4c8bedbd2a67aa44156faf9 (patch)
tree98a65593155573f12b42a3de134817476a4f49c1 /tests
parentc63b6349b44019146cc2edcef8141692891b9401 (diff)
downloadrust-ff191a808e563d36b4c8bedbd2a67aa44156faf9.tar.gz
rust-ff191a808e563d36b4c8bedbd2a67aa44156faf9.zip
Restrict use_self on nested items
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/use_self.rs33
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::*;
-        }
-    }
-}