summary refs log tree commit diff
path: root/tests/ui/resolve/global-scope-resolution.rs
diff options
context:
space:
mode:
authorKivooeo <Kivooeo123@gmail.com>2025-06-09 02:16:25 +0500
committerKivooeo <Kivooeo123@gmail.com>2025-06-11 20:51:49 +0500
commitc6c55cc0cb63667833c54c13ad4a2eb576d48e13 (patch)
tree32ae5b6ade574c1282453e7caa8778cc1765474e /tests/ui/resolve/global-scope-resolution.rs
parent8072811356a178dbdf8ca09b1635cfafd4661971 (diff)
downloadrust-c6c55cc0cb63667833c54c13ad4a2eb576d48e13.tar.gz
rust-c6c55cc0cb63667833c54c13ad4a2eb576d48e13.zip
cleaned up some tests
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();
+}