about summary refs log tree commit diff
path: root/compiler/rustc_span/src/edit_distance.rs
diff options
context:
space:
mode:
authoryukang <moorekang@gmail.com>2023-04-06 06:51:49 +0800
committeryukang <moorekang@gmail.com>2023-04-06 06:51:49 +0800
commit4fc3c6b07a5aff0bb3da87496daf825b128d6e08 (patch)
tree9ca8883d266d2f89db5a54f4adf47a4a6911013f /compiler/rustc_span/src/edit_distance.rs
parent7b4f436a30f00c8b8bf533b92592385cba2ea5f1 (diff)
downloadrust-4fc3c6b07a5aff0bb3da87496daf825b128d6e08.tar.gz
rust-4fc3c6b07a5aff0bb3da87496daf825b128d6e08.zip
add comment
Diffstat (limited to 'compiler/rustc_span/src/edit_distance.rs')
-rw-r--r--compiler/rustc_span/src/edit_distance.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_span/src/edit_distance.rs b/compiler/rustc_span/src/edit_distance.rs
index 19c4aae97ef..9fe9e3a7a5f 100644
--- a/compiler/rustc_span/src/edit_distance.rs
+++ b/compiler/rustc_span/src/edit_distance.rs
@@ -218,6 +218,9 @@ fn find_best_match_for_name_impl(
         }
     }
 
+    // We have a tie among several candidates, try to select the best among them ignoring substrings.
+    // For example, the candidates list `force_capture`, `capture`, and user inputed `forced_capture`,
+    // we select `force_capture` with a extra round of edit distance calculation.
     if next_candidates.len() > 1 {
         debug_assert!(use_substring_score);
         best = find_best_match_for_name_impl(