1
Fork 0

Don't create an FnDef of a DefKind::Variant, use the ctor def id

This commit is contained in:
Michael Goulet 2024-04-02 14:13:25 -04:00
parent b4e2d75d35
commit cc5105d246

View file

@ -474,9 +474,9 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<Ty
VariantData::Unit(..) | VariantData::Struct { .. } => { VariantData::Unit(..) | VariantData::Struct { .. } => {
tcx.type_of(tcx.hir().get_parent_item(hir_id)).instantiate_identity() tcx.type_of(tcx.hir().get_parent_item(hir_id)).instantiate_identity()
} }
VariantData::Tuple(..) => { VariantData::Tuple(_, _, ctor) => {
let args = ty::GenericArgs::identity_for_item(tcx, def_id); let args = ty::GenericArgs::identity_for_item(tcx, def_id);
Ty::new_fn_def(tcx, def_id.to_def_id(), args) Ty::new_fn_def(tcx, ctor.to_def_id(), args)
} }
}, },