Rollup merge of #126673 - oli-obk:dont_rely_on_err_reporting, r=compi… · rust-lang/rust@49bdf46

File tree

1 file changed

lines changed

  • compiler/rustc_hir_typeck/src

1 file changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -1245,11 +1245,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {

12451245

expr,

12461246

);

12471247
1248-

return self

1248+

return Err(self

12491249

.commit_if_ok(|_| {

1250-

self.at(cause, self.param_env).lub(DefineOpaqueTypes::No, prev_ty, new_ty)

1250+

self.at(cause, self.param_env).lub(DefineOpaqueTypes::Yes, prev_ty, new_ty)

12511251

})

1252-

.map(|ok| self.register_infer_ok_obligations(ok));

1252+

.unwrap_err());

12531253

}

12541254

}

12551255

@@ -1259,10 +1259,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {

12591259

if let Some(e) = first_error {

12601260

Err(e)

12611261

} else {

1262-

self.commit_if_ok(|_| {

1263-

self.at(cause, self.param_env).lub(DefineOpaqueTypes::No, prev_ty, new_ty)

1264-

})

1265-

.map(|ok| self.register_infer_ok_obligations(ok))

1262+

Err(self

1263+

.commit_if_ok(|_| {

1264+

self.at(cause, self.param_env).lub(

1265+

DefineOpaqueTypes::Yes,

1266+

prev_ty,

1267+

new_ty,

1268+

)

1269+

})

1270+

.unwrap_err())

12661271

}

12671272

}

12681273

Ok(ok) => {