Prefer using `rustc_middle::ty` types over `rustc_hir` ones
A number of rustc types have two versions: one in the HIR, the other in rustc_middle::ty. For example GenericParam vs GenericParamDef or WherePredicate vs Predicate. The HIR version is more syntactic, the ty version is more semantic.
We often copy both versions in the frontend, because they happen to show up in other types we need. I propose that when possible we substitute the ty version for the HIR one, as I suspect the ty ones are more convenient to use for our purposes.
This issue has been marked as stale due to a lack of activity for 60 days. If you believe this issue is still relevant, please provide an update or comment to keep it open. Otherwise, it will be closed in 7 days.
Still relevant
List of types we can migrate this way:
hir::GenericParam->ty::GenericParamhir::Generics->ty::GenericArghir::Ty-> we should never interact with this, onlyty::Tyhir::FieldDef->ty::FieldDefhir::FnSig->ty::PolyFnSig
After that, the most powerful change we could do would be to migrate from hir::Item to hax::FullDef. This would transitively allow removing ~30 hir::* types without needing to add any new ones.
List of `hir::*` types that are only used transitively by one of the above types:
hir::AnonConsthir::AssocItemKindhir::ConstArghir::ConstArgKindhir::Constnesshir::EnumDefhir::FnDeclhir::FnHeaderhir::FnRetTyhir::ForeignItemhir::ForeignItemKindhir::ForeignItemRefhir::GenericBoundshir::GenericParamKindhir::Implhir::ImplItemhir::ImplItemKindhir::ImplItemRefhir::ImplPolarityhir::IsAsynchir::IsAutohir::ItemIdhir::ItemKindhir::LifetimeParamKindhir::Modhir::OpaqueTyhir::OpaqueTyOriginhir::ParamNamehir::PathSegmenthir::PrimTyhir::TraitItemhir::TraitItemKindhir::TraitItemRefhir::UseKindhir::UsePathhir::Varianthir::VariantData
This issue has been marked as stale due to a lack of activity for 60 days. If you believe this issue is still relevant, please provide an update or comment to keep it open. Otherwise, it will be closed in 7 days.
This issue has been marked as stale due to a lack of activity for 60 days. If you believe this issue is still relevant, please provide an update or comment to keep it open. Otherwise, it will be closed in 7 days.
We won't implement that, instead we'll switch to FullDef in our Rust engine, and drop the OCaml one along with those HIR types