File tree 3 files changed +36
-4
lines changed
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(
174
174
fn find_best_match_for_name_impl (
175
175
use_substring_score : bool ,
176
176
candidates : & [ Symbol ] ,
177
- lookup : Symbol ,
177
+ lookup_symbol : Symbol ,
178
178
dist : Option < usize > ,
179
179
) -> Option < Symbol > {
180
- let lookup = lookup . as_str ( ) ;
180
+ let lookup = lookup_symbol . as_str ( ) ;
181
181
let lookup_uppercase = lookup. to_uppercase ( ) ;
182
182
183
183
// Priority of matches:
@@ -190,6 +190,7 @@ fn find_best_match_for_name_impl(
190
190
191
191
let mut dist = dist. unwrap_or_else ( || cmp:: max ( lookup. len ( ) , 3 ) / 3 ) ;
192
192
let mut best = None ;
193
+ let mut next_candidates = vec ! [ ] ;
193
194
for c in candidates {
194
195
match if use_substring_score {
195
196
edit_distance_with_substrings ( lookup, c. as_str ( ) , dist)
@@ -198,12 +199,27 @@ fn find_best_match_for_name_impl(
198
199
} {
199
200
Some ( 0 ) => return Some ( * c) ,
200
201
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
+ }
203
210
}
204
211
None => { }
205
212
}
206
213
}
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
+ }
207
223
if best. is_some ( ) {
208
224
return best;
209
225
}
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