summary refs log tree commit diff
path: root/tests/ui/resolve/global-scope-resolution.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/resolve/global-scope-resolution.rs')
-rw-r--r--tests/ui/resolve/global-scope-resolution.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ui/resolve/global-scope-resolution.rs b/tests/ui/resolve/global-scope-resolution.rs
new file mode 100644
index 00000000000..176bab36da7
--- /dev/null
+++ b/tests/ui/resolve/global-scope-resolution.rs
@@ -0,0 +1,21 @@
+//! Test global scope resolution with :: operator
+
+//@ run-pass
+
+pub fn f() -> isize {
+    return 1;
+}
+
+pub mod foo {
+    pub fn f() -> isize {
+        return 2;
+    }
+    pub fn g() {
+        assert_eq!(f(), 2);
+        assert_eq!(::f(), 1);
+    }
+}
+
+pub fn main() {
+    return foo::g();
+}