code cleanup with err.emit_unless
This commit is contained in:
parent
465ac26405
commit
3320879f40
2 changed files with 2 additions and 6 deletions
|
@ -1096,11 +1096,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
|
|
||||||
// If the assignment expression itself is ill-formed, don't
|
// If the assignment expression itself is ill-formed, don't
|
||||||
// bother emitting another error
|
// bother emitting another error
|
||||||
let reported = if lhs_ty.references_error() || rhs_ty.references_error() {
|
let reported = err.emit_unless(lhs_ty.references_error() || rhs_ty.references_error());
|
||||||
err.delay_as_bug()
|
|
||||||
} else {
|
|
||||||
err.emit()
|
|
||||||
};
|
|
||||||
return self.tcx.ty_error_with_guaranteed(reported);
|
return self.tcx.ty_error_with_guaranteed(reported);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1310,7 +1310,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
ty: Ty<'tcx>,
|
ty: Ty<'tcx>,
|
||||||
reported: ErrorGuaranteed,
|
reported: ErrorGuaranteed,
|
||||||
) -> Const<'tcx> {
|
) -> Const<'tcx> {
|
||||||
self.mk_const(ty::ConstS { kind: ty::ConstKind::Error(reported), ty })
|
self.mk_const(ty::ConstKind::Error(reported), ty)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Like [TyCtxt::ty_error] but for constants.
|
/// Like [TyCtxt::ty_error] but for constants.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue