@@ -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,
@@ -2046,8 +2051,10 @@ impl<'a> Resolver<'a> {
20462051 if binding_0. binding_mode != binding_i. binding_mode {
20472052 resolve_error ( self ,
20482053 binding_i. span ,
2049- ResolutionError :: VariableBoundWithDifferentMode ( key. name ,
2050- i + 1 ) ) ;
2054+ ResolutionError :: VariableBoundWithDifferentMode (
2055+ key. name ,
2056+ i + 1 ,
2057+ binding_0. span ) ) ;
20512058 }
20522059 }
20532060 }
0 commit comments