mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-11 16:15:03 +00:00
derive various Lift impl instead of hand rolling them
This commit is contained in:
parent
00fcc82df2
commit
d4e986c1f0
@ -8,7 +8,7 @@ use rustc_apfloat::{
|
|||||||
use rustc_macros::HashStable;
|
use rustc_macros::HashStable;
|
||||||
use rustc_target::abi::{HasDataLayout, Size};
|
use rustc_target::abi::{HasDataLayout, Size};
|
||||||
|
|
||||||
use crate::ty::{Lift, ParamEnv, ScalarInt, Ty, TyCtxt};
|
use crate::ty::{ParamEnv, ScalarInt, Ty, TyCtxt};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
AllocId, AllocRange, ConstAllocation, InterpResult, Pointer, PointerArithmetic, Provenance,
|
AllocId, AllocRange, ConstAllocation, InterpResult, Pointer, PointerArithmetic, Provenance,
|
||||||
@ -27,7 +27,7 @@ pub struct ConstAlloc<'tcx> {
|
|||||||
/// Represents a constant value in Rust. `Scalar` and `Slice` are optimizations for
|
/// Represents a constant value in Rust. `Scalar` and `Slice` are optimizations for
|
||||||
/// array length computations, enum discriminants and the pattern matching logic.
|
/// array length computations, enum discriminants and the pattern matching logic.
|
||||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, TyEncodable, TyDecodable, Hash)]
|
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, TyEncodable, TyDecodable, Hash)]
|
||||||
#[derive(HashStable)]
|
#[derive(HashStable, Lift)]
|
||||||
pub enum ConstValue<'tcx> {
|
pub enum ConstValue<'tcx> {
|
||||||
/// Used only for types with `layout::abi::Scalar` ABI.
|
/// Used only for types with `layout::abi::Scalar` ABI.
|
||||||
///
|
///
|
||||||
@ -53,22 +53,6 @@ pub enum ConstValue<'tcx> {
|
|||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||||
static_assert_size!(ConstValue<'_>, 32);
|
static_assert_size!(ConstValue<'_>, 32);
|
||||||
|
|
||||||
impl<'a, 'tcx> Lift<'tcx> for ConstValue<'a> {
|
|
||||||
type Lifted = ConstValue<'tcx>;
|
|
||||||
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<ConstValue<'tcx>> {
|
|
||||||
Some(match self {
|
|
||||||
ConstValue::Scalar(s) => ConstValue::Scalar(s),
|
|
||||||
ConstValue::ZeroSized => ConstValue::ZeroSized,
|
|
||||||
ConstValue::Slice { data, start, end } => {
|
|
||||||
ConstValue::Slice { data: tcx.lift(data)?, start, end }
|
|
||||||
}
|
|
||||||
ConstValue::ByRef { alloc, offset } => {
|
|
||||||
ConstValue::ByRef { alloc: tcx.lift(alloc)?, offset }
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'tcx> ConstValue<'tcx> {
|
impl<'tcx> ConstValue<'tcx> {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn try_to_scalar(&self) -> Option<Scalar<AllocId>> {
|
pub fn try_to_scalar(&self) -> Option<Scalar<AllocId>> {
|
||||||
|
@ -192,12 +192,6 @@ impl<'tcx> TypeFoldable<'tcx> for PlaceElem<'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> TypeFoldable<'tcx> for Field {
|
|
||||||
fn try_fold_with<F: FallibleTypeFolder<'tcx>>(self, _: &mut F) -> Result<Self, F::Error> {
|
|
||||||
Ok(self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'tcx> TypeFoldable<'tcx> for GeneratorSavedLocal {
|
impl<'tcx> TypeFoldable<'tcx> for GeneratorSavedLocal {
|
||||||
fn try_fold_with<F: FallibleTypeFolder<'tcx>>(self, _: &mut F) -> Result<Self, F::Error> {
|
fn try_fold_with<F: FallibleTypeFolder<'tcx>>(self, _: &mut F) -> Result<Self, F::Error> {
|
||||||
Ok(self)
|
Ok(self)
|
||||||
|
@ -149,12 +149,6 @@ impl<'tcx> TypeVisitable<'tcx> for PlaceElem<'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> TypeVisitable<'tcx> for Field {
|
|
||||||
fn visit_with<V: TypeVisitor<'tcx>>(&self, _: &mut V) -> ControlFlow<V::BreakTy> {
|
|
||||||
ControlFlow::CONTINUE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'tcx> TypeVisitable<'tcx> for GeneratorSavedLocal {
|
impl<'tcx> TypeVisitable<'tcx> for GeneratorSavedLocal {
|
||||||
fn visit_with<V: TypeVisitor<'tcx>>(&self, _: &mut V) -> ControlFlow<V::BreakTy> {
|
fn visit_with<V: TypeVisitor<'tcx>>(&self, _: &mut V) -> ControlFlow<V::BreakTy> {
|
||||||
ControlFlow::CONTINUE
|
ControlFlow::CONTINUE
|
||||||
|
@ -77,7 +77,7 @@ pub enum PointerCast {
|
|||||||
/// At some point, of course, `Box` should move out of the compiler, in which
|
/// At some point, of course, `Box` should move out of the compiler, in which
|
||||||
/// case this is analogous to transforming a struct. E.g., `Box<[i32; 4]>` ->
|
/// case this is analogous to transforming a struct. E.g., `Box<[i32; 4]>` ->
|
||||||
/// `Box<[i32]>` is an `Adjust::Unsize` with the target `Box<[i32]>`.
|
/// `Box<[i32]>` is an `Adjust::Unsize` with the target `Box<[i32]>`.
|
||||||
#[derive(Clone, TyEncodable, TyDecodable, HashStable, TypeFoldable, TypeVisitable)]
|
#[derive(Clone, TyEncodable, TyDecodable, HashStable, TypeFoldable, TypeVisitable, Lift)]
|
||||||
pub struct Adjustment<'tcx> {
|
pub struct Adjustment<'tcx> {
|
||||||
pub kind: Adjust<'tcx>,
|
pub kind: Adjust<'tcx>,
|
||||||
pub target: Ty<'tcx>,
|
pub target: Ty<'tcx>,
|
||||||
@ -89,7 +89,7 @@ impl<'tcx> Adjustment<'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, TyEncodable, TyDecodable, HashStable, TypeFoldable, TypeVisitable)]
|
#[derive(Clone, Debug, TyEncodable, TyDecodable, HashStable, TypeFoldable, TypeVisitable, Lift)]
|
||||||
pub enum Adjust<'tcx> {
|
pub enum Adjust<'tcx> {
|
||||||
/// Go from ! to any type.
|
/// Go from ! to any type.
|
||||||
NeverToAny,
|
NeverToAny,
|
||||||
@ -108,7 +108,7 @@ pub enum Adjust<'tcx> {
|
|||||||
/// The target type is `U` in both cases, with the region and mutability
|
/// The target type is `U` in both cases, with the region and mutability
|
||||||
/// being those shared by both the receiver and the returned reference.
|
/// being those shared by both the receiver and the returned reference.
|
||||||
#[derive(Copy, Clone, PartialEq, Debug, TyEncodable, TyDecodable, HashStable)]
|
#[derive(Copy, Clone, PartialEq, Debug, TyEncodable, TyDecodable, HashStable)]
|
||||||
#[derive(TypeFoldable, TypeVisitable)]
|
#[derive(TypeFoldable, TypeVisitable, Lift)]
|
||||||
pub struct OverloadedDeref<'tcx> {
|
pub struct OverloadedDeref<'tcx> {
|
||||||
pub region: ty::Region<'tcx>,
|
pub region: ty::Region<'tcx>,
|
||||||
pub mutbl: hir::Mutability,
|
pub mutbl: hir::Mutability,
|
||||||
@ -167,7 +167,7 @@ impl From<AutoBorrowMutability> for hir::Mutability {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Debug, TyEncodable, TyDecodable, HashStable)]
|
#[derive(Copy, Clone, PartialEq, Debug, TyEncodable, TyDecodable, HashStable)]
|
||||||
#[derive(TypeFoldable, TypeVisitable)]
|
#[derive(TypeFoldable, TypeVisitable, Lift)]
|
||||||
pub enum AutoBorrow<'tcx> {
|
pub enum AutoBorrow<'tcx> {
|
||||||
/// Converts from T to &T.
|
/// Converts from T to &T.
|
||||||
Ref(ty::Region<'tcx>, AutoBorrowMutability),
|
Ref(ty::Region<'tcx>, AutoBorrowMutability),
|
||||||
|
@ -1820,7 +1820,9 @@ nop_list_lift! {bound_variable_kinds; ty::BoundVariableKind => ty::BoundVariable
|
|||||||
// This is the impl for `&'a InternalSubsts<'a>`.
|
// This is the impl for `&'a InternalSubsts<'a>`.
|
||||||
nop_list_lift! {substs; GenericArg<'a> => GenericArg<'tcx>}
|
nop_list_lift! {substs; GenericArg<'a> => GenericArg<'tcx>}
|
||||||
|
|
||||||
CloneLiftImpls! { for<'tcx> { Constness, traits::WellFormedLoc, } }
|
CloneLiftImpls! { for<'tcx> {
|
||||||
|
Constness, traits::WellFormedLoc, ImplPolarity, crate::mir::ReturnConstraint,
|
||||||
|
} }
|
||||||
|
|
||||||
pub mod tls {
|
pub mod tls {
|
||||||
use super::{ptr_eq, GlobalCtxt, TyCtxt};
|
use super::{ptr_eq, GlobalCtxt, TyCtxt};
|
||||||
|
@ -14,7 +14,7 @@ use rustc_target::spec::abi;
|
|||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, TypeFoldable, TypeVisitable)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, TypeFoldable, TypeVisitable, Lift)]
|
||||||
pub struct ExpectedFound<T> {
|
pub struct ExpectedFound<T> {
|
||||||
pub expected: T,
|
pub expected: T,
|
||||||
pub found: T,
|
pub found: T,
|
||||||
@ -31,7 +31,7 @@ impl<T> ExpectedFound<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Data structures used in type unification
|
// Data structures used in type unification
|
||||||
#[derive(Copy, Clone, Debug, TypeFoldable, TypeVisitable)]
|
#[derive(Copy, Clone, Debug, TypeFoldable, TypeVisitable, Lift)]
|
||||||
#[rustc_pass_by_value]
|
#[rustc_pass_by_value]
|
||||||
pub enum TypeError<'tcx> {
|
pub enum TypeError<'tcx> {
|
||||||
Mismatch,
|
Mismatch,
|
||||||
|
@ -27,7 +27,7 @@ pub struct Instance<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
|
||||||
#[derive(TyEncodable, TyDecodable, HashStable, TypeFoldable, TypeVisitable)]
|
#[derive(TyEncodable, TyDecodable, HashStable, TypeFoldable, TypeVisitable, Lift)]
|
||||||
pub enum InstanceDef<'tcx> {
|
pub enum InstanceDef<'tcx> {
|
||||||
/// A user-defined callable item.
|
/// A user-defined callable item.
|
||||||
///
|
///
|
||||||
|
@ -636,7 +636,7 @@ impl rustc_errors::IntoDiagnosticArg for Predicate<'_> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, TyEncodable, TyDecodable)]
|
#[derive(Clone, Copy, PartialEq, Eq, Hash, TyEncodable, TyDecodable)]
|
||||||
#[derive(HashStable, TypeFoldable, TypeVisitable)]
|
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
|
||||||
pub enum PredicateKind<'tcx> {
|
pub enum PredicateKind<'tcx> {
|
||||||
/// Corresponds to `where Foo: Bar<A, B, C>`. `Foo` here would be
|
/// Corresponds to `where Foo: Bar<A, B, C>`. `Foo` here would be
|
||||||
/// the `Self` type of the trait reference and `A`, `B`, and `C`
|
/// the `Self` type of the trait reference and `A`, `B`, and `C`
|
||||||
@ -808,7 +808,7 @@ impl<'tcx> Predicate<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, TyEncodable, TyDecodable)]
|
#[derive(Clone, Copy, PartialEq, Eq, Hash, TyEncodable, TyDecodable)]
|
||||||
#[derive(HashStable, TypeFoldable, TypeVisitable)]
|
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
|
||||||
pub struct TraitPredicate<'tcx> {
|
pub struct TraitPredicate<'tcx> {
|
||||||
pub trait_ref: TraitRef<'tcx>,
|
pub trait_ref: TraitRef<'tcx>,
|
||||||
|
|
||||||
@ -888,7 +888,7 @@ impl<'tcx> PolyTraitPredicate<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)]
|
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)]
|
||||||
#[derive(HashStable, TypeFoldable, TypeVisitable)]
|
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
|
||||||
pub struct OutlivesPredicate<A, B>(pub A, pub B); // `A: B`
|
pub struct OutlivesPredicate<A, B>(pub A, pub B); // `A: B`
|
||||||
pub type RegionOutlivesPredicate<'tcx> = OutlivesPredicate<ty::Region<'tcx>, ty::Region<'tcx>>;
|
pub type RegionOutlivesPredicate<'tcx> = OutlivesPredicate<ty::Region<'tcx>, ty::Region<'tcx>>;
|
||||||
pub type TypeOutlivesPredicate<'tcx> = OutlivesPredicate<Ty<'tcx>, ty::Region<'tcx>>;
|
pub type TypeOutlivesPredicate<'tcx> = OutlivesPredicate<Ty<'tcx>, ty::Region<'tcx>>;
|
||||||
@ -899,7 +899,7 @@ pub type PolyTypeOutlivesPredicate<'tcx> = ty::Binder<'tcx, TypeOutlivesPredicat
|
|||||||
/// whether the `a` type is the type that we should label as "expected" when
|
/// whether the `a` type is the type that we should label as "expected" when
|
||||||
/// presenting user diagnostics.
|
/// presenting user diagnostics.
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, TyEncodable, TyDecodable)]
|
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, TyEncodable, TyDecodable)]
|
||||||
#[derive(HashStable, TypeFoldable, TypeVisitable)]
|
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
|
||||||
pub struct SubtypePredicate<'tcx> {
|
pub struct SubtypePredicate<'tcx> {
|
||||||
pub a_is_expected: bool,
|
pub a_is_expected: bool,
|
||||||
pub a: Ty<'tcx>,
|
pub a: Ty<'tcx>,
|
||||||
@ -909,7 +909,7 @@ pub type PolySubtypePredicate<'tcx> = ty::Binder<'tcx, SubtypePredicate<'tcx>>;
|
|||||||
|
|
||||||
/// Encodes that we have to coerce *from* the `a` type to the `b` type.
|
/// Encodes that we have to coerce *from* the `a` type to the `b` type.
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, TyEncodable, TyDecodable)]
|
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, TyEncodable, TyDecodable)]
|
||||||
#[derive(HashStable, TypeFoldable, TypeVisitable)]
|
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
|
||||||
pub struct CoercePredicate<'tcx> {
|
pub struct CoercePredicate<'tcx> {
|
||||||
pub a: Ty<'tcx>,
|
pub a: Ty<'tcx>,
|
||||||
pub b: Ty<'tcx>,
|
pub b: Ty<'tcx>,
|
||||||
@ -1058,7 +1058,7 @@ impl<'tcx> TermKind<'tcx> {
|
|||||||
/// Form #2 eventually yields one of these `ProjectionPredicate`
|
/// Form #2 eventually yields one of these `ProjectionPredicate`
|
||||||
/// instances to normalize the LHS.
|
/// instances to normalize the LHS.
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable)]
|
#[derive(Copy, Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable)]
|
||||||
#[derive(HashStable, TypeFoldable, TypeVisitable)]
|
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
|
||||||
pub struct ProjectionPredicate<'tcx> {
|
pub struct ProjectionPredicate<'tcx> {
|
||||||
pub projection_ty: ProjectionTy<'tcx>,
|
pub projection_ty: ProjectionTy<'tcx>,
|
||||||
pub term: Term<'tcx>,
|
pub term: Term<'tcx>,
|
||||||
@ -1692,7 +1692,7 @@ impl<'tcx> PolyTraitRef<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, TypeFoldable, TypeVisitable)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, TypeFoldable, TypeVisitable)]
|
||||||
#[derive(HashStable)]
|
#[derive(HashStable, Lift)]
|
||||||
pub struct ParamEnvAnd<'tcx, T> {
|
pub struct ParamEnvAnd<'tcx, T> {
|
||||||
pub param_env: ParamEnv<'tcx>,
|
pub param_env: ParamEnv<'tcx>,
|
||||||
pub value: T,
|
pub value: T,
|
||||||
|
@ -238,6 +238,9 @@ TrivialTypeTraversalAndLiftImpls! {
|
|||||||
crate::ty::Variance,
|
crate::ty::Variance,
|
||||||
::rustc_span::Span,
|
::rustc_span::Span,
|
||||||
::rustc_errors::ErrorGuaranteed,
|
::rustc_errors::ErrorGuaranteed,
|
||||||
|
Field,
|
||||||
|
interpret::Scalar,
|
||||||
|
rustc_target::abi::Size,
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
@ -312,35 +315,6 @@ impl<'tcx, I: Idx, T: Lift<'tcx>> Lift<'tcx> for IndexVec<I, T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx> Lift<'tcx> for ty::TraitRef<'a> {
|
|
||||||
type Lifted = ty::TraitRef<'tcx>;
|
|
||||||
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
|
|
||||||
tcx.lift(self.substs).map(|substs| ty::TraitRef { def_id: self.def_id, substs })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialTraitRef<'a> {
|
|
||||||
type Lifted = ty::ExistentialTraitRef<'tcx>;
|
|
||||||
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
|
|
||||||
tcx.lift(self.substs).map(|substs| ty::ExistentialTraitRef { def_id: self.def_id, substs })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialPredicate<'a> {
|
|
||||||
type Lifted = ty::ExistentialPredicate<'tcx>;
|
|
||||||
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
|
|
||||||
match self {
|
|
||||||
ty::ExistentialPredicate::Trait(x) => tcx.lift(x).map(ty::ExistentialPredicate::Trait),
|
|
||||||
ty::ExistentialPredicate::Projection(x) => {
|
|
||||||
tcx.lift(x).map(ty::ExistentialPredicate::Projection)
|
|
||||||
}
|
|
||||||
ty::ExistentialPredicate::AutoTrait(def_id) => {
|
|
||||||
Some(ty::ExistentialPredicate::AutoTrait(def_id))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'tcx> Lift<'tcx> for Term<'a> {
|
impl<'a, 'tcx> Lift<'tcx> for Term<'a> {
|
||||||
type Lifted = ty::Term<'tcx>;
|
type Lifted = ty::Term<'tcx>;
|
||||||
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
|
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
|
||||||
@ -353,121 +327,6 @@ impl<'a, 'tcx> Lift<'tcx> for Term<'a> {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx> Lift<'tcx> for ty::TraitPredicate<'a> {
|
|
||||||
type Lifted = ty::TraitPredicate<'tcx>;
|
|
||||||
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<ty::TraitPredicate<'tcx>> {
|
|
||||||
tcx.lift(self.trait_ref).map(|trait_ref| ty::TraitPredicate {
|
|
||||||
trait_ref,
|
|
||||||
constness: self.constness,
|
|
||||||
polarity: self.polarity,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'tcx> Lift<'tcx> for ty::SubtypePredicate<'a> {
|
|
||||||
type Lifted = ty::SubtypePredicate<'tcx>;
|
|
||||||
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<ty::SubtypePredicate<'tcx>> {
|
|
||||||
tcx.lift((self.a, self.b)).map(|(a, b)| ty::SubtypePredicate {
|
|
||||||
a_is_expected: self.a_is_expected,
|
|
||||||
a,
|
|
||||||
b,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'tcx> Lift<'tcx> for ty::CoercePredicate<'a> {
|
|
||||||
type Lifted = ty::CoercePredicate<'tcx>;
|
|
||||||
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<ty::CoercePredicate<'tcx>> {
|
|
||||||
tcx.lift((self.a, self.b)).map(|(a, b)| ty::CoercePredicate { a, b })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'tcx, A: Copy + Lift<'tcx>, B: Copy + Lift<'tcx>> Lift<'tcx> for ty::OutlivesPredicate<A, B> {
|
|
||||||
type Lifted = ty::OutlivesPredicate<A::Lifted, B::Lifted>;
|
|
||||||
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
|
|
||||||
tcx.lift((self.0, self.1)).map(|(a, b)| ty::OutlivesPredicate(a, b))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'tcx> Lift<'tcx> for ty::ProjectionTy<'a> {
|
|
||||||
type Lifted = ty::ProjectionTy<'tcx>;
|
|
||||||
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<ty::ProjectionTy<'tcx>> {
|
|
||||||
tcx.lift(self.substs)
|
|
||||||
.map(|substs| ty::ProjectionTy { item_def_id: self.item_def_id, substs })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'tcx> Lift<'tcx> for ty::ProjectionPredicate<'a> {
|
|
||||||
type Lifted = ty::ProjectionPredicate<'tcx>;
|
|
||||||
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<ty::ProjectionPredicate<'tcx>> {
|
|
||||||
tcx.lift((self.projection_ty, self.term))
|
|
||||||
.map(|(projection_ty, term)| ty::ProjectionPredicate { projection_ty, term })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialProjection<'a> {
|
|
||||||
type Lifted = ty::ExistentialProjection<'tcx>;
|
|
||||||
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
|
|
||||||
tcx.lift(self.substs).map(|substs| ty::ExistentialProjection {
|
|
||||||
substs,
|
|
||||||
term: tcx.lift(self.term).expect("type must lift when substs do"),
|
|
||||||
item_def_id: self.item_def_id,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'tcx> Lift<'tcx> for ty::PredicateKind<'a> {
|
|
||||||
type Lifted = ty::PredicateKind<'tcx>;
|
|
||||||
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
|
|
||||||
match self {
|
|
||||||
ty::PredicateKind::Trait(data) => tcx.lift(data).map(ty::PredicateKind::Trait),
|
|
||||||
ty::PredicateKind::Subtype(data) => tcx.lift(data).map(ty::PredicateKind::Subtype),
|
|
||||||
ty::PredicateKind::Coerce(data) => tcx.lift(data).map(ty::PredicateKind::Coerce),
|
|
||||||
ty::PredicateKind::RegionOutlives(data) => {
|
|
||||||
tcx.lift(data).map(ty::PredicateKind::RegionOutlives)
|
|
||||||
}
|
|
||||||
ty::PredicateKind::TypeOutlives(data) => {
|
|
||||||
tcx.lift(data).map(ty::PredicateKind::TypeOutlives)
|
|
||||||
}
|
|
||||||
ty::PredicateKind::Projection(data) => {
|
|
||||||
tcx.lift(data).map(ty::PredicateKind::Projection)
|
|
||||||
}
|
|
||||||
ty::PredicateKind::WellFormed(ty) => tcx.lift(ty).map(ty::PredicateKind::WellFormed),
|
|
||||||
ty::PredicateKind::ClosureKind(closure_def_id, closure_substs, kind) => {
|
|
||||||
tcx.lift(closure_substs).map(|closure_substs| {
|
|
||||||
ty::PredicateKind::ClosureKind(closure_def_id, closure_substs, kind)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
ty::PredicateKind::ObjectSafe(trait_def_id) => {
|
|
||||||
Some(ty::PredicateKind::ObjectSafe(trait_def_id))
|
|
||||||
}
|
|
||||||
ty::PredicateKind::ConstEvaluatable(uv) => {
|
|
||||||
tcx.lift(uv).map(|uv| ty::PredicateKind::ConstEvaluatable(uv))
|
|
||||||
}
|
|
||||||
ty::PredicateKind::ConstEquate(c1, c2) => {
|
|
||||||
tcx.lift((c1, c2)).map(|(c1, c2)| ty::PredicateKind::ConstEquate(c1, c2))
|
|
||||||
}
|
|
||||||
ty::PredicateKind::TypeWellFormedFromEnv(ty) => {
|
|
||||||
tcx.lift(ty).map(ty::PredicateKind::TypeWellFormedFromEnv)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'tcx, T: Lift<'tcx>> Lift<'tcx> for ty::Binder<'a, T>
|
|
||||||
where
|
|
||||||
<T as Lift<'tcx>>::Lifted: TypeVisitable<'tcx>,
|
|
||||||
{
|
|
||||||
type Lifted = ty::Binder<'tcx, T::Lifted>;
|
|
||||||
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
|
|
||||||
let bound_vars = tcx.lift(self.bound_vars());
|
|
||||||
tcx.lift(self.skip_binder())
|
|
||||||
.zip(bound_vars)
|
|
||||||
.map(|(value, vars)| ty::Binder::bind_with_vars(value, vars))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'tcx> Lift<'tcx> for ty::ParamEnv<'a> {
|
impl<'a, 'tcx> Lift<'tcx> for ty::ParamEnv<'a> {
|
||||||
type Lifted = ty::ParamEnv<'tcx>;
|
type Lifted = ty::ParamEnv<'tcx>;
|
||||||
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
|
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
|
||||||
@ -476,192 +335,6 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ParamEnv<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx, T: Lift<'tcx>> Lift<'tcx> for ty::ParamEnvAnd<'a, T> {
|
|
||||||
type Lifted = ty::ParamEnvAnd<'tcx, T::Lifted>;
|
|
||||||
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
|
|
||||||
tcx.lift(self.param_env).and_then(|param_env| {
|
|
||||||
tcx.lift(self.value).map(|value| ty::ParamEnvAnd { param_env, value })
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'tcx> Lift<'tcx> for ty::ClosureSubsts<'a> {
|
|
||||||
type Lifted = ty::ClosureSubsts<'tcx>;
|
|
||||||
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
|
|
||||||
tcx.lift(self.substs).map(|substs| ty::ClosureSubsts { substs })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'tcx> Lift<'tcx> for ty::GeneratorSubsts<'a> {
|
|
||||||
type Lifted = ty::GeneratorSubsts<'tcx>;
|
|
||||||
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
|
|
||||||
tcx.lift(self.substs).map(|substs| ty::GeneratorSubsts { substs })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::Adjustment<'a> {
|
|
||||||
type Lifted = ty::adjustment::Adjustment<'tcx>;
|
|
||||||
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
|
|
||||||
let ty::adjustment::Adjustment { kind, target } = self;
|
|
||||||
tcx.lift(kind).and_then(|kind| {
|
|
||||||
tcx.lift(target).map(|target| ty::adjustment::Adjustment { kind, target })
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::Adjust<'a> {
|
|
||||||
type Lifted = ty::adjustment::Adjust<'tcx>;
|
|
||||||
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
|
|
||||||
match self {
|
|
||||||
ty::adjustment::Adjust::NeverToAny => Some(ty::adjustment::Adjust::NeverToAny),
|
|
||||||
ty::adjustment::Adjust::Pointer(ptr) => Some(ty::adjustment::Adjust::Pointer(ptr)),
|
|
||||||
ty::adjustment::Adjust::Deref(overloaded) => {
|
|
||||||
tcx.lift(overloaded).map(ty::adjustment::Adjust::Deref)
|
|
||||||
}
|
|
||||||
ty::adjustment::Adjust::Borrow(autoref) => {
|
|
||||||
tcx.lift(autoref).map(ty::adjustment::Adjust::Borrow)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::OverloadedDeref<'a> {
|
|
||||||
type Lifted = ty::adjustment::OverloadedDeref<'tcx>;
|
|
||||||
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
|
|
||||||
tcx.lift(self.region).map(|region| ty::adjustment::OverloadedDeref {
|
|
||||||
region,
|
|
||||||
mutbl: self.mutbl,
|
|
||||||
span: self.span,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::AutoBorrow<'a> {
|
|
||||||
type Lifted = ty::adjustment::AutoBorrow<'tcx>;
|
|
||||||
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
|
|
||||||
match self {
|
|
||||||
ty::adjustment::AutoBorrow::Ref(r, m) => {
|
|
||||||
tcx.lift(r).map(|r| ty::adjustment::AutoBorrow::Ref(r, m))
|
|
||||||
}
|
|
||||||
ty::adjustment::AutoBorrow::RawPtr(m) => Some(ty::adjustment::AutoBorrow::RawPtr(m)),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'tcx> Lift<'tcx> for ty::GenSig<'a> {
|
|
||||||
type Lifted = ty::GenSig<'tcx>;
|
|
||||||
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
|
|
||||||
tcx.lift((self.resume_ty, self.yield_ty, self.return_ty))
|
|
||||||
.map(|(resume_ty, yield_ty, return_ty)| ty::GenSig { resume_ty, yield_ty, return_ty })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'tcx> Lift<'tcx> for ty::FnSig<'a> {
|
|
||||||
type Lifted = ty::FnSig<'tcx>;
|
|
||||||
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
|
|
||||||
tcx.lift(self.inputs_and_output).map(|x| ty::FnSig {
|
|
||||||
inputs_and_output: x,
|
|
||||||
c_variadic: self.c_variadic,
|
|
||||||
unsafety: self.unsafety,
|
|
||||||
abi: self.abi,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for ty::error::ExpectedFound<T> {
|
|
||||||
type Lifted = ty::error::ExpectedFound<T::Lifted>;
|
|
||||||
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
|
|
||||||
let ty::error::ExpectedFound { expected, found } = self;
|
|
||||||
tcx.lift(expected).and_then(|expected| {
|
|
||||||
tcx.lift(found).map(|found| ty::error::ExpectedFound { expected, found })
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'tcx> Lift<'tcx> for ty::error::TypeError<'a> {
|
|
||||||
type Lifted = ty::error::TypeError<'tcx>;
|
|
||||||
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
|
|
||||||
use crate::ty::error::TypeError::*;
|
|
||||||
|
|
||||||
Some(match self {
|
|
||||||
Mismatch => Mismatch,
|
|
||||||
ConstnessMismatch(x) => ConstnessMismatch(x),
|
|
||||||
PolarityMismatch(x) => PolarityMismatch(x),
|
|
||||||
UnsafetyMismatch(x) => UnsafetyMismatch(x),
|
|
||||||
AbiMismatch(x) => AbiMismatch(x),
|
|
||||||
Mutability => Mutability,
|
|
||||||
ArgumentMutability(i) => ArgumentMutability(i),
|
|
||||||
TupleSize(x) => TupleSize(x),
|
|
||||||
FixedArraySize(x) => FixedArraySize(x),
|
|
||||||
ArgCount => ArgCount,
|
|
||||||
FieldMisMatch(x, y) => FieldMisMatch(x, y),
|
|
||||||
RegionsDoesNotOutlive(a, b) => {
|
|
||||||
return tcx.lift((a, b)).map(|(a, b)| RegionsDoesNotOutlive(a, b));
|
|
||||||
}
|
|
||||||
RegionsInsufficientlyPolymorphic(a, b) => {
|
|
||||||
return tcx.lift(b).map(|b| RegionsInsufficientlyPolymorphic(a, b));
|
|
||||||
}
|
|
||||||
RegionsOverlyPolymorphic(a, b) => {
|
|
||||||
return tcx.lift(b).map(|b| RegionsOverlyPolymorphic(a, b));
|
|
||||||
}
|
|
||||||
RegionsPlaceholderMismatch => RegionsPlaceholderMismatch,
|
|
||||||
IntMismatch(x) => IntMismatch(x),
|
|
||||||
FloatMismatch(x) => FloatMismatch(x),
|
|
||||||
Traits(x) => Traits(x),
|
|
||||||
VariadicMismatch(x) => VariadicMismatch(x),
|
|
||||||
CyclicTy(t) => return tcx.lift(t).map(|t| CyclicTy(t)),
|
|
||||||
CyclicConst(ct) => return tcx.lift(ct).map(|ct| CyclicConst(ct)),
|
|
||||||
ProjectionMismatched(x) => ProjectionMismatched(x),
|
|
||||||
ArgumentSorts(x, i) => return tcx.lift(x).map(|x| ArgumentSorts(x, i)),
|
|
||||||
Sorts(x) => return tcx.lift(x).map(Sorts),
|
|
||||||
ExistentialMismatch(x) => return tcx.lift(x).map(ExistentialMismatch),
|
|
||||||
ConstMismatch(x) => return tcx.lift(x).map(ConstMismatch),
|
|
||||||
IntrinsicCast => IntrinsicCast,
|
|
||||||
TargetFeatureCast(x) => TargetFeatureCast(x),
|
|
||||||
ObjectUnsafeCoercion(x) => return tcx.lift(x).map(ObjectUnsafeCoercion),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'tcx> Lift<'tcx> for ty::InstanceDef<'a> {
|
|
||||||
type Lifted = ty::InstanceDef<'tcx>;
|
|
||||||
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
|
|
||||||
match self {
|
|
||||||
ty::InstanceDef::Item(def_id) => Some(ty::InstanceDef::Item(def_id)),
|
|
||||||
ty::InstanceDef::VTableShim(def_id) => Some(ty::InstanceDef::VTableShim(def_id)),
|
|
||||||
ty::InstanceDef::ReifyShim(def_id) => Some(ty::InstanceDef::ReifyShim(def_id)),
|
|
||||||
ty::InstanceDef::Intrinsic(def_id) => Some(ty::InstanceDef::Intrinsic(def_id)),
|
|
||||||
ty::InstanceDef::FnPtrShim(def_id, ty) => {
|
|
||||||
Some(ty::InstanceDef::FnPtrShim(def_id, tcx.lift(ty)?))
|
|
||||||
}
|
|
||||||
ty::InstanceDef::Virtual(def_id, n) => Some(ty::InstanceDef::Virtual(def_id, n)),
|
|
||||||
ty::InstanceDef::ClosureOnceShim { call_once, track_caller } => {
|
|
||||||
Some(ty::InstanceDef::ClosureOnceShim { call_once, track_caller })
|
|
||||||
}
|
|
||||||
ty::InstanceDef::DropGlue(def_id, ty) => {
|
|
||||||
Some(ty::InstanceDef::DropGlue(def_id, tcx.lift(ty)?))
|
|
||||||
}
|
|
||||||
ty::InstanceDef::CloneShim(def_id, ty) => {
|
|
||||||
Some(ty::InstanceDef::CloneShim(def_id, tcx.lift(ty)?))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'tcx> Lift<'tcx> for Field {
|
|
||||||
type Lifted = Field;
|
|
||||||
fn lift_to_tcx(self, _tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
|
|
||||||
Some(self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'tcx> Lift<'tcx> for crate::mir::ReturnConstraint {
|
|
||||||
type Lifted = crate::mir::ReturnConstraint;
|
|
||||||
fn lift_to_tcx(self, _tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
|
|
||||||
Some(self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// TypeFoldable implementations.
|
// TypeFoldable implementations.
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ static_assert_size!(TyKind<'_>, 32);
|
|||||||
/// * `GR`: The "return type", which is the type of value returned upon
|
/// * `GR`: The "return type", which is the type of value returned upon
|
||||||
/// completion of the generator.
|
/// completion of the generator.
|
||||||
/// * `GW`: The "generator witness".
|
/// * `GW`: The "generator witness".
|
||||||
#[derive(Copy, Clone, Debug, TypeFoldable, TypeVisitable)]
|
#[derive(Copy, Clone, Debug, TypeFoldable, TypeVisitable, Lift)]
|
||||||
pub struct ClosureSubsts<'tcx> {
|
pub struct ClosureSubsts<'tcx> {
|
||||||
/// Lifetime and type parameters from the enclosing function,
|
/// Lifetime and type parameters from the enclosing function,
|
||||||
/// concatenated with a tuple containing the types of the upvars.
|
/// concatenated with a tuple containing the types of the upvars.
|
||||||
@ -333,7 +333,7 @@ impl<'tcx> ClosureSubsts<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Similar to `ClosureSubsts`; see the above documentation for more.
|
/// Similar to `ClosureSubsts`; see the above documentation for more.
|
||||||
#[derive(Copy, Clone, Debug, TypeFoldable, TypeVisitable)]
|
#[derive(Copy, Clone, Debug, TypeFoldable, TypeVisitable, Lift)]
|
||||||
pub struct GeneratorSubsts<'tcx> {
|
pub struct GeneratorSubsts<'tcx> {
|
||||||
pub substs: SubstsRef<'tcx>,
|
pub substs: SubstsRef<'tcx>,
|
||||||
}
|
}
|
||||||
@ -660,7 +660,7 @@ impl<'tcx> InlineConstSubsts<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, PartialOrd, Ord, Eq, Hash, TyEncodable, TyDecodable)]
|
#[derive(Debug, Copy, Clone, PartialEq, PartialOrd, Ord, Eq, Hash, TyEncodable, TyDecodable)]
|
||||||
#[derive(HashStable, TypeFoldable, TypeVisitable)]
|
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
|
||||||
pub enum ExistentialPredicate<'tcx> {
|
pub enum ExistentialPredicate<'tcx> {
|
||||||
/// E.g., `Iterator`.
|
/// E.g., `Iterator`.
|
||||||
Trait(ExistentialTraitRef<'tcx>),
|
Trait(ExistentialTraitRef<'tcx>),
|
||||||
@ -789,7 +789,7 @@ impl<'tcx> List<ty::Binder<'tcx, ExistentialPredicate<'tcx>>> {
|
|||||||
/// Trait references also appear in object types like `Foo<U>`, but in
|
/// Trait references also appear in object types like `Foo<U>`, but in
|
||||||
/// that case the `Self` parameter is absent from the substitutions.
|
/// that case the `Self` parameter is absent from the substitutions.
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, TyEncodable, TyDecodable)]
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, TyEncodable, TyDecodable)]
|
||||||
#[derive(HashStable, TypeFoldable, TypeVisitable)]
|
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
|
||||||
pub struct TraitRef<'tcx> {
|
pub struct TraitRef<'tcx> {
|
||||||
pub def_id: DefId,
|
pub def_id: DefId,
|
||||||
pub substs: SubstsRef<'tcx>,
|
pub substs: SubstsRef<'tcx>,
|
||||||
@ -867,7 +867,7 @@ impl rustc_errors::IntoDiagnosticArg for PolyTraitRef<'_> {
|
|||||||
/// The substitutions don't include the erased `Self`, only trait
|
/// The substitutions don't include the erased `Self`, only trait
|
||||||
/// type and lifetime parameters (`[X, Y]` and `['a, 'b]` above).
|
/// type and lifetime parameters (`[X, Y]` and `['a, 'b]` above).
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, TyEncodable, TyDecodable)]
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, TyEncodable, TyDecodable)]
|
||||||
#[derive(HashStable, TypeFoldable, TypeVisitable)]
|
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
|
||||||
pub struct ExistentialTraitRef<'tcx> {
|
pub struct ExistentialTraitRef<'tcx> {
|
||||||
pub def_id: DefId,
|
pub def_id: DefId,
|
||||||
pub substs: SubstsRef<'tcx>,
|
pub substs: SubstsRef<'tcx>,
|
||||||
@ -1023,7 +1023,7 @@ impl BoundVariableKind {
|
|||||||
///
|
///
|
||||||
/// `Decodable` and `Encodable` are implemented for `Binder<T>` using the `impl_binder_encode_decode!` macro.
|
/// `Decodable` and `Encodable` are implemented for `Binder<T>` using the `impl_binder_encode_decode!` macro.
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
|
||||||
#[derive(HashStable)]
|
#[derive(HashStable, Lift)]
|
||||||
pub struct Binder<'tcx, T>(T, &'tcx List<BoundVariableKind>);
|
pub struct Binder<'tcx, T>(T, &'tcx List<BoundVariableKind>);
|
||||||
|
|
||||||
impl<'tcx, T> Binder<'tcx, T>
|
impl<'tcx, T> Binder<'tcx, T>
|
||||||
@ -1185,7 +1185,7 @@ impl<'tcx, T> Binder<'tcx, Option<T>> {
|
|||||||
/// Represents the projection of an associated type. In explicit UFCS
|
/// Represents the projection of an associated type. In explicit UFCS
|
||||||
/// form this would be written `<T as Trait<..>>::N`.
|
/// form this would be written `<T as Trait<..>>::N`.
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)]
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)]
|
||||||
#[derive(HashStable, TypeFoldable, TypeVisitable)]
|
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
|
||||||
pub struct ProjectionTy<'tcx> {
|
pub struct ProjectionTy<'tcx> {
|
||||||
/// The parameters of the associated item.
|
/// The parameters of the associated item.
|
||||||
pub substs: SubstsRef<'tcx>,
|
pub substs: SubstsRef<'tcx>,
|
||||||
@ -1237,7 +1237,7 @@ impl<'tcx> ProjectionTy<'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, TypeFoldable, TypeVisitable)]
|
#[derive(Copy, Clone, Debug, TypeFoldable, TypeVisitable, Lift)]
|
||||||
pub struct GenSig<'tcx> {
|
pub struct GenSig<'tcx> {
|
||||||
pub resume_ty: Ty<'tcx>,
|
pub resume_ty: Ty<'tcx>,
|
||||||
pub yield_ty: Ty<'tcx>,
|
pub yield_ty: Ty<'tcx>,
|
||||||
@ -1253,7 +1253,7 @@ pub type PolyGenSig<'tcx> = Binder<'tcx, GenSig<'tcx>>;
|
|||||||
/// - `output`: is the return type.
|
/// - `output`: is the return type.
|
||||||
/// - `c_variadic`: indicates whether this is a C-variadic function.
|
/// - `c_variadic`: indicates whether this is a C-variadic function.
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, TyEncodable, TyDecodable)]
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, TyEncodable, TyDecodable)]
|
||||||
#[derive(HashStable, TypeFoldable, TypeVisitable)]
|
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
|
||||||
pub struct FnSig<'tcx> {
|
pub struct FnSig<'tcx> {
|
||||||
pub inputs_and_output: &'tcx List<Ty<'tcx>>,
|
pub inputs_and_output: &'tcx List<Ty<'tcx>>,
|
||||||
pub c_variadic: bool,
|
pub c_variadic: bool,
|
||||||
@ -1435,7 +1435,7 @@ impl From<BoundVar> for BoundTy {
|
|||||||
|
|
||||||
/// A `ProjectionPredicate` for an `ExistentialTraitRef`.
|
/// A `ProjectionPredicate` for an `ExistentialTraitRef`.
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)]
|
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)]
|
||||||
#[derive(HashStable, TypeFoldable, TypeVisitable)]
|
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
|
||||||
pub struct ExistentialProjection<'tcx> {
|
pub struct ExistentialProjection<'tcx> {
|
||||||
pub item_def_id: DefId,
|
pub item_def_id: DefId,
|
||||||
pub substs: SubstsRef<'tcx>,
|
pub substs: SubstsRef<'tcx>,
|
||||||
|
Loading…
Reference in New Issue
Block a user