Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue when there are multiple candidates for edit_distance_with_substrings #109395

Merged
merged 3 commits into from
Apr 6, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
add comment
  • Loading branch information
chenyukang committed Apr 5, 2023
commit 4fc3c6b07a5aff0bb3da87496daf825b128d6e08
3 changes: 3 additions & 0 deletions compiler/rustc_span/src/edit_distance.rs
Original file line number Diff line number Diff line change
@@ -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 {
chenyukang marked this conversation as resolved.
Show resolved Hide resolved
debug_assert!(use_substring_score);
best = find_best_match_for_name_impl(