diff --git a/frontend/exporter/src/types/copied.rs b/frontend/exporter/src/types/copied.rs index 1464caa5c..c35329c71 100644 --- a/frontend/exporter/src/types/copied.rs +++ b/frontend/exporter/src/types/copied.rs @@ -305,6 +305,47 @@ pub struct ParamConst { pub name: Symbol, } +/// A predicate without `Self`, for use in `dyn Trait`. +/// +/// Reflects [`rustc_middle::ty::ExistentialPredicate`] +#[derive(AdtInto)] +#[args(<'tcx, S: UnderOwnerState<'tcx>>, from: rustc_middle::ty::ExistentialPredicate<'tcx>, state: S as state)] +#[derive( + Clone, Debug, Serialize, Deserialize, JsonSchema, Hash, PartialEq, Eq, PartialOrd, Ord, +)] +pub enum ExistentialPredicate { + /// E.g. `From`. Note that this isn't `T: From` with a given `T`, this is just + /// `From`. Could be written `?: From`. + Trait(ExistentialTraitRef), + /// E.g. `Iterator::Item = u64`. Could be written `::Item = u64`. + Projection(ExistentialProjection), + /// E.g. `Send`. + AutoTrait(DefId), +} + +/// Reflects [`rustc_type_ir::ExistentialTraitRef`] +#[derive(AdtInto)] +#[args(<'tcx, S: UnderOwnerState<'tcx>>, from: rustc_type_ir::ExistentialTraitRef>, state: S as state)] +#[derive( + Clone, Debug, Serialize, Deserialize, JsonSchema, Hash, PartialEq, Eq, PartialOrd, Ord, +)] +pub struct ExistentialTraitRef { + pub def_id: DefId, + pub args: Vec, +} + +/// Reflects [`rustc_type_ir::ExistentialProjection`] +#[derive(AdtInto)] +#[args(<'tcx, S: UnderOwnerState<'tcx>>, from: rustc_type_ir::ExistentialProjection>, state: S as state)] +#[derive( + Clone, Debug, Serialize, Deserialize, JsonSchema, Hash, PartialEq, Eq, PartialOrd, Ord, +)] +pub struct ExistentialProjection { + pub def_id: DefId, + pub args: Vec, + pub term: Term, +} + /// Reflects [`rustc_middle::ty::DynKind`] #[derive( AdtInto, Clone, Debug, Serialize, Deserialize, JsonSchema, Hash, PartialEq, Eq, PartialOrd, Ord, diff --git a/frontend/exporter/src/types/todo.rs b/frontend/exporter/src/types/todo.rs index 5a92d0d2d..52a656113 100644 --- a/frontend/exporter/src/types/todo.rs +++ b/frontend/exporter/src/types/todo.rs @@ -1,7 +1,6 @@ use crate::prelude::*; use crate::sinto_todo; sinto_todo!(rustc_middle::ty, ScalarInt); -sinto_todo!(rustc_middle::ty, ExistentialPredicate<'a>); sinto_todo!(rustc_middle::ty, AdtFlags); sinto_todo!(rustc_middle::ty, NormalizesTo<'tcx>); sinto_todo!(rustc_abi, IntegerType);