@@ -117,7 +117,7 @@ enum ResolutionError<'a> {
117117 /// error E0408: variable `{}` from pattern #{} is not bound in pattern #{}
118118 VariableNotBoundInPattern ( Name , usize , usize ) ,
119119 /// error E0409: variable is bound with different mode in pattern #{} than in pattern #1
120- VariableBoundWithDifferentMode ( Name , usize ) ,
120+ VariableBoundWithDifferentMode ( Name , usize , Span ) ,
121121 /// error E0411: use of `Self` outside of an impl or trait
122122 SelfUsedOutsideImplOrTrait ,
123123 /// error E0412: use of undeclared
@@ -270,14 +270,19 @@ fn resolve_struct_error<'b, 'a: 'b, 'c>(resolver: &'b Resolver<'a>,
270270 from,
271271 to)
272272 }
273- ResolutionError :: VariableBoundWithDifferentMode ( variable_name, pattern_number) => {
274- struct_span_err ! ( resolver. session,
273+ ResolutionError :: VariableBoundWithDifferentMode ( variable_name,
274+ pattern_number,
275+ first_binding_span) => {
276+ let mut err = struct_span_err ! ( resolver. session,
275277 span,
276278 E0409 ,
277279 "variable `{}` is bound with different mode in pattern #{} than in \
278280 pattern #1",
279281 variable_name,
280- pattern_number)
282+ pattern_number) ;
283+ err. span_label ( span, & format ! ( "bound in different ways" ) ) ;
284+ err. span_label ( first_binding_span, & format ! ( "first binding" ) ) ;
285+ err
281286 }
282287 ResolutionError :: SelfUsedOutsideImplOrTrait => {
283288 let mut err = struct_span_err ! ( resolver. session,
@@ -2044,8 +2049,10 @@ impl<'a> Resolver<'a> {
20442049 if binding_0. binding_mode != binding_i. binding_mode {
20452050 resolve_error ( self ,
20462051 binding_i. span ,
2047- ResolutionError :: VariableBoundWithDifferentMode ( key. name ,
2048- i + 1 ) ) ;
2052+ ResolutionError :: VariableBoundWithDifferentMode (
2053+ key. name ,
2054+ i + 1 ,
2055+ binding_0. span ) ) ;
20492056 }
20502057 }
20512058 }
0 commit comments