File tree Expand file tree Collapse file tree 3 files changed +36
-4
lines changed Expand file tree Collapse file tree 3 files changed +36
-4
lines changed Original file line number Diff line number Diff line change @@ -174,10 +174,10 @@ pub fn find_best_match_for_name(
174174fn find_best_match_for_name_impl (
175175 use_substring_score : bool ,
176176 candidates : & [ Symbol ] ,
177- lookup : Symbol ,
177+ lookup_symbol : Symbol ,
178178 dist : Option < usize > ,
179179) -> Option < Symbol > {
180- let lookup = lookup . as_str ( ) ;
180+ let lookup = lookup_symbol . as_str ( ) ;
181181 let lookup_uppercase = lookup. to_uppercase ( ) ;
182182
183183 // Priority of matches:
@@ -190,6 +190,7 @@ fn find_best_match_for_name_impl(
190190
191191 let mut dist = dist. unwrap_or_else ( || cmp:: max ( lookup. len ( ) , 3 ) / 3 ) ;
192192 let mut best = None ;
193+ let mut next_candidates = vec ! [ ] ;
193194 for c in candidates {
194195 match if use_substring_score {
195196 edit_distance_with_substrings ( lookup, c. as_str ( ) , dist)
@@ -198,12 +199,27 @@ fn find_best_match_for_name_impl(
198199 } {
199200 Some ( 0 ) => return Some ( * c) ,
200201 Some ( d) => {
201- dist = d - 1 ;
202- best = Some ( * c) ;
202+ if use_substring_score {
203+ dist = d;
204+ next_candidates. push ( * c) ;
205+ best = Some ( * c) ;
206+ } else {
207+ dist = d - 1 ;
208+ best = Some ( * c) ;
209+ }
203210 }
204211 None => { }
205212 }
206213 }
214+
215+ if next_candidates. len ( ) > 1 {
216+ best = find_best_match_for_name_impl (
217+ false ,
218+ & next_candidates,
219+ lookup_symbol,
220+ Some ( lookup. len ( ) ) ,
221+ ) ;
222+ }
207223 if best. is_some ( ) {
208224 return best;
209225 }
Original file line number Diff line number Diff line change 1+ fn main ( ) {
2+ println ! ( "Custom backtrace: {}" , std:: backtrace:: Backtrace :: forced_capture( ) ) ;
3+ //~^ ERROR no function or associated item name
4+ }
Original file line number Diff line number Diff line change 1+ error[E0599]: no function or associated item named `forced_capture` found for struct `Backtrace` in the current scope
2+ --> $DIR/issue-109291.rs:2:65
3+ |
4+ LL | println!("Custom backtrace: {}", std::backtrace::Backtrace::forced_capture());
5+ | ^^^^^^^^^^^^^^
6+ | |
7+ | function or associated item not found in `Backtrace`
8+ | help: there is an associated function with a similar name: `force_capture`
9+
10+ error: aborting due to previous error
11+
12+ For more information about this error, try `rustc --explain E0599`.
You can’t perform that action at this time.
0 commit comments