IAT: Introduce AliasKind::Inherent
This commit is contained in:
parent
6f8c0557e0
commit
e8139dfd5a
82 changed files with 1008 additions and 167 deletions
|
@ -372,6 +372,7 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::Ty<RustInterner<'tcx>>> for Ty<'tcx> {
|
|||
substitution: substs.lower_into(interner),
|
||||
}))
|
||||
}
|
||||
ty::Alias(ty::Inherent, _) => unimplemented!(),
|
||||
ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs, .. }) => {
|
||||
chalk_ir::TyKind::Alias(chalk_ir::AliasTy::Opaque(chalk_ir::OpaqueTy {
|
||||
opaque_ty_id: chalk_ir::OpaqueTyId(def_id),
|
||||
|
|
|
@ -10,7 +10,7 @@ use rustc_trait_selection::traits::{self, ObligationCause, SelectionContext};
|
|||
use std::sync::atomic::Ordering;
|
||||
|
||||
pub(crate) fn provide(p: &mut Providers) {
|
||||
*p = Providers { normalize_projection_ty, ..*p };
|
||||
*p = Providers { normalize_projection_ty, normalize_inherent_projection_ty, ..*p };
|
||||
}
|
||||
|
||||
fn normalize_projection_ty<'tcx>(
|
||||
|
@ -42,3 +42,30 @@ fn normalize_projection_ty<'tcx>(
|
|||
},
|
||||
)
|
||||
}
|
||||
|
||||
fn normalize_inherent_projection_ty<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
goal: CanonicalProjectionGoal<'tcx>,
|
||||
) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, NormalizationResult<'tcx>>>, NoSolution> {
|
||||
debug!("normalize_provider(goal={:#?})", goal);
|
||||
|
||||
tcx.infer_ctxt().enter_canonical_trait_query(
|
||||
&goal,
|
||||
|ocx, ParamEnvAnd { param_env, value: goal }| {
|
||||
let selcx = &mut SelectionContext::new(ocx.infcx);
|
||||
let cause = ObligationCause::dummy();
|
||||
let mut obligations = vec![];
|
||||
let answer = traits::normalize_inherent_projection(
|
||||
selcx,
|
||||
param_env,
|
||||
goal,
|
||||
cause,
|
||||
0,
|
||||
&mut obligations,
|
||||
);
|
||||
ocx.register_obligations(obligations);
|
||||
|
||||
Ok(NormalizationResult { normalized_ty: answer })
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue