]> git.lizzy.rs Git - rust.git/commitdiff
Fix ICE
authorMatthew Jasper <mjjasper1@gmail.com>
Wed, 1 Jul 2020 20:56:35 +0000 (21:56 +0100)
committerMatthew Jasper <mjjasper1@gmail.com>
Tue, 6 Oct 2020 10:19:30 +0000 (11:19 +0100)
compiler/rustc_trait_selection/src/traits/select/confirmation.rs

index 1ed4cca107e7716bd927fda3401721cb9406d2bd..319217e8fdc449863275cc33eeeb33b831c363d2 100644 (file)
@@ -342,7 +342,8 @@ fn confirm_object_candidate(
     ) -> ImplSourceObjectData<'tcx, PredicateObligation<'tcx>> {
         debug!("confirm_object_candidate({:?})", obligation);
 
-        let self_ty = self.infcx.replace_bound_vars_with_placeholders(&obligation.self_ty());
+        let self_ty = self.infcx.shallow_resolve(obligation.self_ty());
+        let self_ty = self.infcx.replace_bound_vars_with_placeholders(&self_ty);
         let data = match self_ty.kind() {
             ty::Dynamic(data, ..) => data,
             _ => span_bug!(obligation.cause.span, "object candidate with non-object"),
@@ -448,7 +449,7 @@ fn confirm_fn_pointer_candidate(
         )
         .map_bound(|(trait_ref, _)| trait_ref);
 
-        let Normalized { value: trait_ref, obligations } = ensure_sufficient_stack(|| {
+        let Normalized { value: trait_ref, mut obligations } = ensure_sufficient_stack(|| {
             project::normalize_with_depth(
                 self,
                 obligation.param_env,
@@ -458,12 +459,12 @@ fn confirm_fn_pointer_candidate(
             )
         });
 
-        self.confirm_poly_trait_refs(
+        obligations.extend(self.confirm_poly_trait_refs(
             obligation.cause.clone(),
             obligation.param_env,
             obligation.predicate.to_poly_trait_ref(),
             trait_ref,
-        )?;
+        )?);
         Ok(ImplSourceFnPointerData { fn_ty: self_ty, nested: obligations })
     }