@@ -2307,13 +2307,15 @@ impl<'a> Resolver<'a> {
2307
2307
. map ( |suggestion| import_candidate_to_paths ( & suggestion) ) . collect :: < Vec < _ > > ( ) ;
2308
2308
enum_candidates. sort ( ) ;
2309
2309
for ( sp, variant_path, enum_path) in enum_candidates {
2310
- let msg = format ! ( "there is an enum variant `{}`, did you mean to use `{}`?" ,
2311
- variant_path,
2312
- enum_path) ;
2313
2310
if sp == DUMMY_SP {
2311
+ let msg = format ! ( "there is an enum variant `{}`, \
2312
+ try using `{}`?",
2313
+ variant_path,
2314
+ enum_path) ;
2314
2315
err. help ( & msg) ;
2315
2316
} else {
2316
- err. span_help ( sp, & msg) ;
2317
+ err. span_suggestion ( span, "you can try using the variant's enum" ,
2318
+ enum_path) ;
2317
2319
}
2318
2320
}
2319
2321
}
@@ -2322,18 +2324,20 @@ impl<'a> Resolver<'a> {
2322
2324
let self_is_available = this. self_value_is_available ( path[ 0 ] . ctxt , span) ;
2323
2325
match candidate {
2324
2326
AssocSuggestion :: Field => {
2325
- err. span_label ( span, format ! ( "did you mean `self.{}`?" , path_str) ) ;
2327
+ err. span_suggestion ( span, "try" ,
2328
+ format ! ( "self.{}" , path_str) ) ;
2326
2329
if !self_is_available {
2327
2330
err. span_label ( span, format ! ( "`self` value is only available in \
2328
2331
methods with `self` parameter") ) ;
2329
2332
}
2330
2333
}
2331
2334
AssocSuggestion :: MethodWithSelf if self_is_available => {
2332
- err. span_label ( span, format ! ( "did you mean `self.{}(...)`? ",
2333
- path_str) ) ;
2335
+ err. span_suggestion ( span, "try ",
2336
+ format ! ( "self.{}" , path_str) ) ;
2334
2337
}
2335
2338
AssocSuggestion :: MethodWithSelf | AssocSuggestion :: AssocItem => {
2336
- err. span_label ( span, format ! ( "did you mean `Self::{}`?" , path_str) ) ;
2339
+ err. span_suggestion ( span, "try" ,
2340
+ format ! ( "Self::{}" , path_str) ) ;
2337
2341
}
2338
2342
}
2339
2343
return err;
0 commit comments