about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2016-04-05 16:43:20 +0530
committerManish Goregaokar <manishsmail@gmail.com>2016-04-05 16:43:20 +0530
commitbdd264a0bb48488346be4b5b8bb879530fd186a1 (patch)
tree540dcee34cb57cc400c2ddc2d4fa685d9621d982 /src/test
parent7fd331e16642363c333804fe3322ae6bc0be8fbc (diff)
parent6c73134fc740a09e22db6a3c2438339c155ef577 (diff)
downloadrust-bdd264a0bb48488346be4b5b8bb879530fd186a1.tar.gz
rust-bdd264a0bb48488346be4b5b8bb879530fd186a1.zip
Rollup merge of #32403 - vlastachu:super_in_path, r=jseyfried
Fix issue: Global paths in `use` directives can begin with `super` or `self` #32225

This PR fixes #32225 by warning on `use ::super::...` and `use ::self::...` on `resolve`.

Current changes is the most minimal and ad-hoc.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/use-super-global-path.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/compile-fail/use-super-global-path.rs b/src/test/compile-fail/use-super-global-path.rs
new file mode 100644
index 00000000000..d721d428f29
--- /dev/null
+++ b/src/test/compile-fail/use-super-global-path.rs
@@ -0,0 +1,22 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(rustc_attrs)]
+
+mod foo {
+    pub fn g() {
+        use ::super::main; //~ WARN expected identifier, found keyword `super`
+        //~^ WARN this was previously accepted by the compiler but is being phased out
+        main();
+    }
+}
+
+#[rustc_error]
+fn main() { foo::g(); } //~ ERROR compilation successful