Properly deal with missing/placeholder types inside GACs
This commit is contained in:
parent
791adf759c
commit
24afa42a90
3 changed files with 58 additions and 4 deletions
|
@ -235,11 +235,16 @@ fn infer_type_if_missing<'tcx>(fcx: &FnCtxt<'_, 'tcx>, node: Node<'tcx>) -> Opti
|
|||
if let Some(item) = tcx.opt_associated_item(def_id.into())
|
||||
&& let ty::AssocKind::Const = item.kind
|
||||
&& let ty::ImplContainer = item.container
|
||||
&& let Some(trait_item) = item.trait_item_def_id
|
||||
&& let Some(trait_item_def_id) = item.trait_item_def_id
|
||||
{
|
||||
let args =
|
||||
tcx.impl_trait_ref(item.container_id(tcx)).unwrap().instantiate_identity().args;
|
||||
Some(tcx.type_of(trait_item).instantiate(tcx, args))
|
||||
let impl_def_id = item.container_id(tcx);
|
||||
let impl_trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap().instantiate_identity();
|
||||
let args = ty::GenericArgs::identity_for_item(tcx, def_id).rebase_onto(
|
||||
tcx,
|
||||
impl_def_id,
|
||||
impl_trait_ref.args,
|
||||
);
|
||||
Some(tcx.type_of(trait_item_def_id).instantiate(tcx, args))
|
||||
} else {
|
||||
Some(fcx.next_ty_var(span))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue