about summary refs log tree commit diff
diff options
context:
space:
mode:
authorroife <roifewu@gmail.com>2024-03-05 19:31:01 +0800
committerroife <roifewu@gmail.com>2024-03-05 19:31:20 +0800
commit16995ceda94b68f2bf667e1f7eff022ea795de50 (patch)
tree879eb403b8f0824904fc27b5e467c3b97383f3ce
parent96a7c6ae3cc69ace6c2e77cc4a4c7f453c07998c (diff)
downloadrust-16995ceda94b68f2bf667e1f7eff022ea795de50.tar.gz
rust-16995ceda94b68f2bf667e1f7eff022ea795de50.zip
test: add tests for constants inside range pattern
-rw-r--r--crates/ide/src/goto_definition.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs
index 41148db6146..aac01384cbd 100644
--- a/crates/ide/src/goto_definition.rs
+++ b/crates/ide/src/goto_definition.rs
@@ -536,6 +536,24 @@ fn bar() {
         );
     }
 
+        #[test]
+    fn goto_definition_works_for_consts_inside_range_pattern() {
+        check(
+            r#"
+//- /lib.rs
+const A: u32 = 0;
+    //^
+
+fn bar(v: u32) {
+    match v {
+        0..=$0A => {}
+        _ => {}
+    }
+}
+"#,
+        );
+    }
+
     #[test]
     fn goto_def_for_use_alias() {
         check(