Skip to content

Commit 21eccbb

Browse files
committed
Fix ICE
1 parent 0dda415 commit 21eccbb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

compiler/rustc_trait_selection/src/traits/select/confirmation.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
342342
) -> ImplSourceObjectData<'tcx, PredicateObligation<'tcx>> {
343343
debug!("confirm_object_candidate({:?})", obligation);
344344

345-
let self_ty = self.infcx.replace_bound_vars_with_placeholders(&obligation.self_ty());
345+
let self_ty = self.infcx.shallow_resolve(obligation.self_ty());
346+
let self_ty = self.infcx.replace_bound_vars_with_placeholders(&self_ty);
346347
let data = match self_ty.kind() {
347348
ty::Dynamic(data, ..) => data,
348349
_ => span_bug!(obligation.cause.span, "object candidate with non-object"),
@@ -448,7 +449,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
448449
)
449450
.map_bound(|(trait_ref, _)| trait_ref);
450451

451-
let Normalized { value: trait_ref, obligations } = ensure_sufficient_stack(|| {
452+
let Normalized { value: trait_ref, mut obligations } = ensure_sufficient_stack(|| {
452453
project::normalize_with_depth(
453454
self,
454455
obligation.param_env,
@@ -458,12 +459,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
458459
)
459460
});
460461

461-
self.confirm_poly_trait_refs(
462+
obligations.extend(self.confirm_poly_trait_refs(
462463
obligation.cause.clone(),
463464
obligation.param_env,
464465
obligation.predicate.to_poly_trait_ref(),
465466
trait_ref,
466-
)?;
467+
)?);
467468
Ok(ImplSourceFnPointerData { fn_ty: self_ty, nested: obligations })
468469
}
469470

0 commit comments

Comments
 (0)