Rollup merge of #111723 - lcnr:overwrite-obligations, r=compiler-errors

style: do not overwrite obligations

this looks sketchy and would break if the original obligations do not start out empty 😁
This commit is contained in:
Dylan DPC 2023-05-20 12:21:01 +05:30 committed by GitHub
commit c453b48fd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -530,19 +530,18 @@ impl<'tcx> InferCtxt<'tcx> {
// these are the same span, but not in cases like `-> (impl
// Foo, impl Bar)`.
let span = cause.span;
let mut obligations = vec![];
let prev = self.inner.borrow_mut().opaque_types().register(
OpaqueTypeKey { def_id, substs },
OpaqueHiddenType { ty: hidden_ty, span },
origin,
);
if let Some(prev) = prev {
obligations = self
.at(&cause, param_env)
let mut obligations = if let Some(prev) = prev {
self.at(&cause, param_env)
.eq_exp(DefineOpaqueTypes::Yes, a_is_expected, prev, hidden_ty)?
.obligations;
}
.obligations
} else {
Vec::new()
};
let item_bounds = tcx.explicit_item_bounds(def_id);