1
Fork 0

Fix const-generics ICE related to binding

This commit is contained in:
Yuki Okushi 2021-07-02 08:02:11 +09:00
parent ce331ee6ee
commit 242ac57015
No known key found for this signature in database
GPG key ID: DABA5B072961C18A
5 changed files with 150 additions and 1 deletions

View file

@ -115,7 +115,14 @@ fn resolve_associated_item<'tcx>(
);
let trait_ref = ty::TraitRef::from_method(tcx, trait_id, rcvr_substs);
let vtbl = tcx.codegen_fulfill_obligation((param_env, ty::Binder::bind(trait_ref, tcx)))?;
let vtbl = if trait_item.kind == ty::AssocKind::Const {
let bound_vars = tcx
.mk_bound_variable_kinds(std::iter::once(ty::BoundVariableKind::Region(ty::BrAnon(0))));
let bind = ty::Binder::bind_with_vars(trait_ref, bound_vars);
tcx.codegen_fulfill_obligation((param_env, bind))?
} else {
tcx.codegen_fulfill_obligation((param_env, ty::Binder::bind(trait_ref, tcx)))?
};
// Now that we know which impl is being used, we can dispatch to
// the actual function: