Skip to content

Commit

Permalink
Rollup merge of rust-lang#111723 - lcnr:overwrite-obligations, r=comp…
Browse files Browse the repository at this point in the history
…iler-errors

style: do not overwrite obligations

this looks sketchy and would break if the original obligations do not start out empty 😁
  • Loading branch information
GuillaumeGomez authored May 19, 2023
2 parents 7853c25 + 3e4ed61 commit 6bb24b1
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions compiler/rustc_infer/src/infer/opaque_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 6bb24b1

Please sign in to comment.