1
Fork 0

Use a struct instead of a tuple

This commit is contained in:
Oli Scherer 2024-02-10 21:46:44 +00:00
parent 916951efcc
commit 90a43f1406
8 changed files with 19 additions and 10 deletions

View file

@ -177,9 +177,8 @@ impl EraseType for Option<mir::DestructuredConstant<'_>> {
type Result = [u8; size_of::<Option<mir::DestructuredConstant<'static>>>()];
}
impl EraseType for Option<(ty::EarlyBinder<ty::TraitRef<'_>>, ty::ImplPolarity)> {
type Result =
[u8; size_of::<Option<(ty::EarlyBinder<ty::TraitRef<'static>>, ty::ImplPolarity)>>()];
impl EraseType for Option<ty::EarlyBinder<ty::ImplTraitHeader<'_>>> {
type Result = [u8; size_of::<Option<ty::EarlyBinder<ty::ImplTraitHeader<'static>>>>()];
}
impl EraseType for Option<ty::EarlyBinder<Ty<'_>>> {

View file

@ -848,7 +848,7 @@ rustc_queries! {
/// Given an `impl_id`, return the trait it implements along with some header information.
/// Return `None` if this is an inherent impl.
query impl_trait_header(impl_id: DefId) -> Option<(ty::EarlyBinder<ty::TraitRef<'tcx>>, ty::ImplPolarity)> {
query impl_trait_header(impl_id: DefId) -> Option<ty::EarlyBinder<ty::ImplTraitHeader<'tcx>>> {
desc { |tcx| "computing trait implemented by `{}`", tcx.def_path_str(impl_id) }
cache_on_disk_if { impl_id.is_local() }
separate_provide_extern

View file

@ -2315,7 +2315,7 @@ impl<'tcx> TyCtxt<'tcx> {
self,
def_id: impl IntoQueryParam<DefId>,
) -> Option<ty::EarlyBinder<ty::TraitRef<'tcx>>> {
Some(self.impl_trait_header(def_id)?.0)
Some(self.impl_trait_header(def_id)?.map_bound(|h| h.trait_ref))
}
}

View file

@ -248,6 +248,12 @@ pub struct ImplHeader<'tcx> {
pub predicates: Vec<Predicate<'tcx>>,
}
#[derive(Copy, Clone, Debug, TypeFoldable, TypeVisitable, TyEncodable, TyDecodable, HashStable)]
pub struct ImplTraitHeader<'tcx> {
pub trait_ref: ty::TraitRef<'tcx>,
pub polarity: ImplPolarity,
}
#[derive(Copy, Clone, PartialEq, Eq, Debug, TypeFoldable, TypeVisitable)]
pub enum ImplSubject<'tcx> {
Trait(TraitRef<'tcx>),

View file

@ -134,4 +134,5 @@ parameterized_over_tcx! {
ty::Predicate,
ty::Clause,
ty::ClauseKind,
ty::ImplTraitHeader
}