Replace a bool with a Result<(), ErrorGuaranteed> · rust-lang/rust@7566307 (original) (raw)

Original file line number Diff line number Diff line change
@@ -1256,7 +1256,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1256 1256 subpats,
1257 1257 &variant.fields.raw,
1258 1258 expected,
1259 - had_err.is_err(),
1259 + had_err,
1260 1260 );
1261 1261 on_error(e);
1262 1262 return Ty::new_error(tcx, e);
@@ -1272,7 +1272,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1272 1272 subpats: &'tcx [Pat<'tcx>],
1273 1273 fields: &'tcx [ty::FieldDef],
1274 1274 expected: Ty<'tcx>,
1275 -had_err: bool,
1275 +had_err: Result<(), ErrorGuaranteed>,
1276 1276 ) -> ErrorGuaranteed {
1277 1277 let subpats_ending = pluralize!(subpats.len());
1278 1278 let fields_ending = pluralize!(fields.len());
@@ -1329,7 +1329,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1329 1329 // #67037: only do this if we could successfully type-check the expected type against
1330 1330 // the tuple struct pattern. Otherwise the args could get out of range on e.g.,
1331 1331 // `let P() = U;` where `P != U` with `struct P(T);`.
1332 -(ty::Adt(_, args), [field], false) => {
1332 +(ty::Adt(_, args), [field], Ok(())) => {
1333 1333 let field_ty = self.field_ty(pat_span, field, args);
1334 1334 match field_ty.kind() {
1335 1335 ty::Tuple(fields) => fields.len() == subpats.len(),