@@ -116,7 +116,7 @@ enum ResolutionError<'a> {
116116 /// error E0408: variable `{}` from pattern #{} is not bound in pattern #{}
117117 VariableNotBoundInPattern ( Name , usize , usize ) ,
118118 /// error E0409: variable is bound with different mode in pattern #{} than in pattern #1
119- VariableBoundWithDifferentMode ( Name , usize ) ,
119+ VariableBoundWithDifferentMode ( Name , usize , Span ) ,
120120 /// error E0411: use of `Self` outside of an impl or trait
121121 SelfUsedOutsideImplOrTrait ,
122122 /// error E0412: use of undeclared
@@ -269,14 +269,19 @@ fn resolve_struct_error<'b, 'a: 'b, 'c>(resolver: &'b Resolver<'a>,
269269 from,
270270 to)
271271 }
272- ResolutionError :: VariableBoundWithDifferentMode ( variable_name, pattern_number) => {
273- struct_span_err ! ( resolver. session,
272+ ResolutionError :: VariableBoundWithDifferentMode ( variable_name,
273+ pattern_number,
274+ first_binding_span) => {
275+ let mut err = struct_span_err ! ( resolver. session,
274276 span,
275277 E0409 ,
276278 "variable `{}` is bound with different mode in pattern #{} than in \
277279 pattern #1",
278280 variable_name,
279- pattern_number)
281+ pattern_number) ;
282+ err. span_label ( span, & format ! ( "bound in different ways" ) ) ;
283+ err. span_label ( first_binding_span, & format ! ( "first binding" ) ) ;
284+ err
280285 }
281286 ResolutionError :: SelfUsedOutsideImplOrTrait => {
282287 let mut err = struct_span_err ! ( resolver. session,
@@ -2030,8 +2035,10 @@ impl<'a> Resolver<'a> {
20302035 if binding_0. binding_mode != binding_i. binding_mode {
20312036 resolve_error ( self ,
20322037 binding_i. span ,
2033- ResolutionError :: VariableBoundWithDifferentMode ( key. name ,
2034- i + 1 ) ) ;
2038+ ResolutionError :: VariableBoundWithDifferentMode (
2039+ key. name ,
2040+ i + 1 ,
2041+ binding_0. span ) ) ;
20352042 }
20362043 }
20372044 }
0 commit comments