@@ -1127,18 +1127,14 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
1127
1127
/// the message in `secondary_span` as the primary label, and apply the message that would
1128
1128
/// otherwise be used for the primary label on the `secondary_span` `Span`. This applies on
1129
1129
/// E0271, like `tests/ui/issues/issue-39970.stderr`.
1130
- #[ instrument(
1131
- level = "debug" ,
1132
- skip( self , diag, secondary_span, swap_secondary_and_primary, prefer_label)
1133
- ) ]
1130
+ #[ instrument( level = "debug" , skip( self , diag, secondary_span, prefer_label) ) ]
1134
1131
pub fn note_type_err (
1135
1132
& self ,
1136
1133
diag : & mut Diag < ' _ > ,
1137
1134
cause : & ObligationCause < ' tcx > ,
1138
- secondary_span : Option < ( Span , Cow < ' static , str > ) > ,
1135
+ secondary_span : Option < ( Span , Cow < ' static , str > , bool ) > ,
1139
1136
mut values : Option < ValuePairs < ' tcx > > ,
1140
1137
terr : TypeError < ' tcx > ,
1141
- swap_secondary_and_primary : bool ,
1142
1138
prefer_label : bool ,
1143
1139
) {
1144
1140
let span = cause. span ( ) ;
@@ -1304,7 +1300,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
1304
1300
diag. span_note ( span, msg) ;
1305
1301
}
1306
1302
} ;
1307
- if let Some ( ( sp , msg ) ) = secondary_span {
1303
+ if let Some ( ( secondary_span , secondary_msg , swap_secondary_and_primary ) ) = secondary_span {
1308
1304
if swap_secondary_and_primary {
1309
1305
let terr = if let Some ( infer:: ValuePairs :: Terms ( ExpectedFound {
1310
1306
expected, ..
@@ -1314,11 +1310,11 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
1314
1310
} else {
1315
1311
terr. to_string ( self . tcx )
1316
1312
} ;
1317
- label_or_note ( sp , terr) ;
1318
- label_or_note ( span, msg ) ;
1313
+ label_or_note ( secondary_span , terr) ;
1314
+ label_or_note ( span, secondary_msg ) ;
1319
1315
} else {
1320
1316
label_or_note ( span, terr. to_string ( self . tcx ) ) ;
1321
- label_or_note ( sp , msg ) ;
1317
+ label_or_note ( secondary_span , secondary_msg ) ;
1322
1318
}
1323
1319
} else if let Some ( values) = values
1324
1320
&& let Some ( ( e, f) ) = values. ty ( )
@@ -1788,7 +1784,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
1788
1784
self . type_error_additional_suggestions ( & trace, terr) ,
1789
1785
) ;
1790
1786
let mut diag = self . dcx ( ) . create_err ( failure_code) ;
1791
- self . note_type_err ( & mut diag, & trace. cause , None , Some ( trace. values ) , terr, false , false ) ;
1787
+ self . note_type_err ( & mut diag, & trace. cause , None , Some ( trace. values ) , terr, false ) ;
1792
1788
diag
1793
1789
}
1794
1790
0 commit comments