@@ -879,9 +879,15 @@ enum NameBindingKind<'a> {
879
879
}
880
880
}
881
881
882
- #[ derive( Clone , Debug ) ]
883
882
struct PrivacyError < ' a > ( Span , Name , & ' a NameBinding < ' a > ) ;
884
883
884
+ struct AmbiguityError < ' a > {
885
+ span : Span ,
886
+ name : Name ,
887
+ b1 : & ' a NameBinding < ' a > ,
888
+ b2 : & ' a NameBinding < ' a > ,
889
+ }
890
+
885
891
impl < ' a > NameBinding < ' a > {
886
892
fn module ( & self ) -> Result < Module < ' a > , bool /* true if an error has already been reported */ > {
887
893
match self . kind {
@@ -1057,7 +1063,7 @@ pub struct Resolver<'a> {
1057
1063
pub maybe_unused_trait_imports : NodeSet ,
1058
1064
1059
1065
privacy_errors : Vec < PrivacyError < ' a > > ,
1060
- ambiguity_errors : Vec < ( Span , Name , & ' a NameBinding < ' a > , & ' a NameBinding < ' a > ) > ,
1066
+ ambiguity_errors : Vec < AmbiguityError < ' a > > ,
1061
1067
1062
1068
arenas : & ' a ResolverArenas < ' a > ,
1063
1069
dummy_binding : & ' a NameBinding < ' a > ,
@@ -1278,7 +1284,8 @@ impl<'a> Resolver<'a> {
1278
1284
}
1279
1285
NameBindingKind :: Import { .. } => false ,
1280
1286
NameBindingKind :: Ambiguity { b1, b2 } => {
1281
- self . ambiguity_errors . push ( ( span, name, b1, b2) ) ;
1287
+ let ambiguity_error = AmbiguityError { span : span, name : name, b1 : b1, b2 : b2 } ;
1288
+ self . ambiguity_errors . push ( ambiguity_error) ;
1282
1289
true
1283
1290
}
1284
1291
_ => false
@@ -3302,7 +3309,7 @@ impl<'a> Resolver<'a> {
3302
3309
fn report_errors ( & self ) {
3303
3310
let mut reported_spans = FnvHashSet ( ) ;
3304
3311
3305
- for & ( span, name, b1, b2) in & self . ambiguity_errors {
3312
+ for & AmbiguityError { span, name, b1, b2 } in & self . ambiguity_errors {
3306
3313
if !reported_spans. insert ( span) { continue }
3307
3314
let msg1 = format ! ( "`{}` could resolve to the name imported here" , name) ;
3308
3315
let msg2 = format ! ( "`{}` could also resolve to the name imported here" , name) ;
0 commit comments