diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 73df4372947d..a92ed9cd3ae8 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -979,7 +979,7 @@ pub(crate) fn into_struct_error( .source_map() .span_extend_to_prev_str(ident.span, current, true, false); - let ((with, with_label), without) = match sp { + let (with, with_label, without) = match sp { Some(sp) if !self.tcx.sess.source_map().is_multiline(sp) => { let sp = sp .with_lo(BytePos(sp.lo().0 - (current.len() as u32))) @@ -1000,23 +1000,26 @@ pub(crate) fn into_struct_error( if is_simple_binding { ( - (Some(errs::AttemptToUseNonConstantValueInConstantWithSuggestion { + Some(errs::AttemptToUseNonConstantValueInConstantWithSuggestion { span: sp, suggestion, current, type_span, - }), Some(errs::AttemptToUseNonConstantValueInConstantLabelWithSuggestion {span})), + }), + Some(errs::AttemptToUseNonConstantValueInConstantLabelWithSuggestion { span }), None, ) } else { ( - (None, Some(errs::AttemptToUseNonConstantValueInConstantLabelWithSuggestion {span})), + None, + Some(errs::AttemptToUseNonConstantValueInConstantLabelWithSuggestion { span }), None, ) } } _ => ( - (None, None), + None, + None, Some(errs::AttemptToUseNonConstantValueInConstantWithoutSuggestion { ident_span: ident.span, suggestion,