about summary refs log tree commit diff
path: root/src/tools/rust-analyzer/crates/ide
diff options
context:
space:
mode:
authorHayashi Mikihiro <34ttrweoewiwe28@gmail.com>2025-02-10 10:50:11 +0900
committerHayashi Mikihiro <34ttrweoewiwe28@gmail.com>2025-02-10 17:46:43 +0900
commitef8574aa0463c513a2b77a62b339f73fa8e5e9e0 (patch)
tree649c5f4069314e25af0daf208d9476cbcc11b93b /src/tools/rust-analyzer/crates/ide
parentd4f7c7668fece15523ae6f38e437cad01ee5ded6 (diff)
downloadrust-ef8574aa0463c513a2b77a62b339f73fa8e5e9e0.tar.gz
rust-ef8574aa0463c513a2b77a62b339f73fa8e5e9e0.zip
Shadowing BuiltinType by Module
Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
Diffstat (limited to 'src/tools/rust-analyzer/crates/ide')
-rw-r--r--src/tools/rust-analyzer/crates/ide/src/goto_definition.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/tools/rust-analyzer/crates/ide/src/goto_definition.rs b/src/tools/rust-analyzer/crates/ide/src/goto_definition.rs
index bdafb701ff5..60a904233a9 100644
--- a/src/tools/rust-analyzer/crates/ide/src/goto_definition.rs
+++ b/src/tools/rust-analyzer/crates/ide/src/goto_definition.rs
@@ -3290,4 +3290,38 @@ fn main() {
     "#,
         );
     }
+
+    #[test]
+    fn shadow_builtin_type_by_module() {
+        check(
+            r#"
+mod Foo{
+pub mod str {
+     // ^^^
+    pub fn foo() {}
+}
+}
+
+fn main() {
+    use Foo::str;
+    let s = st$0r::foo();
+}
+"#,
+        );
+    }
+
+    #[test]
+    fn not_goto_module_because_str_is_builtin_type() {
+        check(
+            r#"
+mod str {
+pub fn foo() {}
+}
+
+fn main() {
+    let s = st$0r::f();
+}
+"#,
+        );
+    }
 }