From 033d1df19b3835c184dabfa1c7cab42337fa36b6 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Fri, 15 Nov 2019 18:19:52 +0100 Subject: [PATCH] Retire BraceStructLiftImpl. --- src/librustc/infer/canonical/mod.rs | 38 +++---------------- src/librustc/infer/region_constraints/mod.rs | 9 +---- src/librustc/macros.rs | 19 ---------- src/librustc/mir/interpret/mod.rs | 3 +- src/librustc/traits/query/dropck_outlives.rs | 9 +---- src/librustc/traits/query/normalize.rs | 9 +---- .../traits/query/type_op/ascribe_user_type.rs | 9 +---- src/librustc/traits/query/type_op/eq.rs | 10 +---- .../query/type_op/implied_outlives_bounds.rs | 9 +---- .../traits/query/type_op/normalize.rs | 9 +---- src/librustc/traits/query/type_op/outlives.rs | 9 +---- .../traits/query/type_op/prove_predicate.rs | 9 +---- src/librustc/traits/query/type_op/subtype.rs | 10 +---- src/librustc/ty/context.rs | 9 +---- src/librustc/ty/instance.rs | 3 +- src/librustc/ty/structural_impls.rs | 24 +----------- src/librustc/ty/sty.rs | 2 +- src/librustc/ty/subst.rs | 20 +--------- src/librustc_traits/chalk_context/mod.rs | 12 +----- 19 files changed, 26 insertions(+), 196 deletions(-) diff --git a/src/librustc/infer/canonical/mod.rs b/src/librustc/infer/canonical/mod.rs index ee79960259d..b0f65ac6e1b 100644 --- a/src/librustc/infer/canonical/mod.rs +++ b/src/librustc/infer/canonical/mod.rs @@ -32,7 +32,7 @@ use std::ops::Index; use syntax::source_map::Span; use crate::ty::fold::TypeFoldable; use crate::ty::subst::GenericArg; -use crate::ty::{self, BoundVar, Lift, List, Region, TyCtxt}; +use crate::ty::{self, BoundVar, List, Region, TyCtxt}; mod canonicalizer; @@ -44,7 +44,7 @@ mod substitute; /// variables have been rewritten to "canonical vars". These are /// numbered starting from 0 in order of first appearance. #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcDecodable, RustcEncodable)] -#[derive(HashStable, TypeFoldable)] +#[derive(HashStable, TypeFoldable, Lift)] pub struct Canonical<'tcx, V> { pub max_universe: ty::UniverseIndex, pub variables: CanonicalVarInfos<'tcx>, @@ -65,7 +65,7 @@ impl<'tcx> UseSpecializedDecodable for CanonicalVarInfos<'tcx> {} /// variables. You will need to supply it later to instantiate the /// canonicalized query response. #[derive(Clone, Debug, PartialEq, Eq, Hash, RustcDecodable, RustcEncodable)] -#[derive(HashStable, TypeFoldable)] +#[derive(HashStable, TypeFoldable, Lift)] pub struct CanonicalVarValues<'tcx> { pub var_values: IndexVec>, } @@ -188,7 +188,7 @@ pub enum CanonicalTyVarKind { /// After we execute a query with a canonicalized key, we get back a /// `Canonical>`. You can use /// `instantiate_query_result` to access the data in this result. -#[derive(Clone, Debug, HashStable, TypeFoldable)] +#[derive(Clone, Debug, HashStable, TypeFoldable, Lift)] pub struct QueryResponse<'tcx, R> { pub var_values: CanonicalVarValues<'tcx>, pub region_constraints: QueryRegionConstraints<'tcx>, @@ -196,7 +196,7 @@ pub struct QueryResponse<'tcx, R> { pub value: R, } -#[derive(Clone, Debug, Default, HashStable, TypeFoldable)] +#[derive(Clone, Debug, Default, HashStable, TypeFoldable, Lift)] pub struct QueryRegionConstraints<'tcx> { pub outlives: Vec>, pub member_constraints: Vec>, @@ -469,13 +469,6 @@ CloneTypeFoldableImpls! { } } -BraceStructLiftImpl! { - impl<'a, 'tcx, T> Lift<'tcx> for Canonical<'a, T> { - type Lifted = Canonical<'tcx, T::Lifted>; - max_universe, variables, value - } where T: Lift<'tcx> -} - impl<'tcx> CanonicalVarValues<'tcx> { pub fn len(&self) -> usize { self.var_values.len() @@ -521,27 +514,6 @@ impl<'a, 'tcx> IntoIterator for &'a CanonicalVarValues<'tcx> { } } -BraceStructLiftImpl! { - impl<'a, 'tcx> Lift<'tcx> for CanonicalVarValues<'a> { - type Lifted = CanonicalVarValues<'tcx>; - var_values, - } -} - -BraceStructLiftImpl! { - impl<'a, 'tcx, R> Lift<'tcx> for QueryResponse<'a, R> { - type Lifted = QueryResponse<'tcx, R::Lifted>; - var_values, region_constraints, certainty, value - } where R: Lift<'tcx> -} - -BraceStructLiftImpl! { - impl<'a, 'tcx> Lift<'tcx> for QueryRegionConstraints<'a> { - type Lifted = QueryRegionConstraints<'tcx>; - outlives, member_constraints - } -} - impl<'tcx> Index for CanonicalVarValues<'tcx> { type Output = GenericArg<'tcx>; diff --git a/src/librustc/infer/region_constraints/mod.rs b/src/librustc/infer/region_constraints/mod.rs index 01182a73789..402449ce6cc 100644 --- a/src/librustc/infer/region_constraints/mod.rs +++ b/src/librustc/infer/region_constraints/mod.rs @@ -151,7 +151,7 @@ impl Constraint<'_> { /// ``` /// R0 member of [O1..On] /// ``` -#[derive(Debug, Clone, HashStable, TypeFoldable)] +#[derive(Debug, Clone, HashStable, TypeFoldable, Lift)] pub struct MemberConstraint<'tcx> { /// The `DefId` of the opaque type causing this constraint: used for error reporting. pub opaque_type_def_id: DefId, @@ -169,13 +169,6 @@ pub struct MemberConstraint<'tcx> { pub choice_regions: Lrc>>, } -BraceStructLiftImpl! { - impl<'a, 'tcx> Lift<'tcx> for MemberConstraint<'a> { - type Lifted = MemberConstraint<'tcx>; - opaque_type_def_id, definition_span, hidden_ty, member_region, choice_regions - } -} - /// `VerifyGenericBound(T, _, R, RS)`: the parameter type `T` (or /// associated type) must outlive the region `R`. `T` is known to /// outlive `RS`. Therefore, verify that `R <= RS[i]` for some diff --git a/src/librustc/macros.rs b/src/librustc/macros.rs index 2d0538ad8e0..f04030050aa 100644 --- a/src/librustc/macros.rs +++ b/src/librustc/macros.rs @@ -253,25 +253,6 @@ macro_rules! CloneTypeFoldableAndLiftImpls { } } -#[macro_export] -macro_rules! BraceStructLiftImpl { - (impl<$($p:tt),*> Lift<$tcx:tt> for $s:path { - type Lifted = $lifted:ty; - $($field:ident),* $(,)? - } $(where $($wc:tt)*)*) => { - impl<$($p),*> $crate::ty::Lift<$tcx> for $s - $(where $($wc)*)* - { - type Lifted = $lifted; - - fn lift_to_tcx(&self, tcx: TyCtxt<$tcx>) -> Option<$lifted> { - $(let $field = tcx.lift(&self.$field)?;)* - Some(Self::Lifted { $($field),* }) - } - } - }; -} - #[macro_export] macro_rules! EnumLiftImpl { (impl<$($p:tt),*> Lift<$tcx:tt> for $s:path { diff --git a/src/librustc/mir/interpret/mod.rs b/src/librustc/mir/interpret/mod.rs index 6c31d54e081..31c50610ac4 100644 --- a/src/librustc/mir/interpret/mod.rs +++ b/src/librustc/mir/interpret/mod.rs @@ -124,7 +124,8 @@ use rustc_macros::HashStable; use byteorder::{WriteBytesExt, ReadBytesExt, LittleEndian, BigEndian}; /// Uniquely identifies a specific constant or static. -#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, RustcEncodable, RustcDecodable, HashStable)] +#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, RustcEncodable, RustcDecodable)] +#[derive(HashStable, Lift)] pub struct GlobalId<'tcx> { /// For a constant or static, the `Instance` of the item itself. /// For a promoted global, the `Instance` of the function they belong to. diff --git a/src/librustc/traits/query/dropck_outlives.rs b/src/librustc/traits/query/dropck_outlives.rs index 4d6937d325e..93f56804a9f 100644 --- a/src/librustc/traits/query/dropck_outlives.rs +++ b/src/librustc/traits/query/dropck_outlives.rs @@ -79,7 +79,7 @@ impl<'cx, 'tcx> At<'cx, 'tcx> { } } -#[derive(Clone, Debug, Default, TypeFoldable)] +#[derive(Clone, Debug, Default, TypeFoldable, Lift)] pub struct DropckOutlivesResult<'tcx> { pub kinds: Vec>, pub overflows: Vec>, @@ -152,13 +152,6 @@ impl<'tcx> FromIterator> for DtorckConstraint<'tcx> { result } } -BraceStructLiftImpl! { - impl<'a, 'tcx> Lift<'tcx> for DropckOutlivesResult<'a> { - type Lifted = DropckOutlivesResult<'tcx>; - kinds, overflows - } -} - impl_stable_hash_for!(struct DropckOutlivesResult<'tcx> { kinds, overflows }); diff --git a/src/librustc/traits/query/normalize.rs b/src/librustc/traits/query/normalize.rs index 5115119fa74..30528dcebda 100644 --- a/src/librustc/traits/query/normalize.rs +++ b/src/librustc/traits/query/normalize.rs @@ -66,7 +66,7 @@ impl<'cx, 'tcx> At<'cx, 'tcx> { } /// Result from the `normalize_projection_ty` query. -#[derive(Clone, Debug, TypeFoldable)] +#[derive(Clone, Debug, TypeFoldable, Lift)] pub struct NormalizationResult<'tcx> { /// Result of normalization. pub normalized_ty: Ty<'tcx>, @@ -194,13 +194,6 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for QueryNormalizer<'cx, 'tcx> { } } -BraceStructLiftImpl! { - impl<'a, 'tcx> Lift<'tcx> for NormalizationResult<'a> { - type Lifted = NormalizationResult<'tcx>; - normalized_ty - } -} - impl_stable_hash_for!(struct NormalizationResult<'tcx> { normalized_ty }); diff --git a/src/librustc/traits/query/type_op/ascribe_user_type.rs b/src/librustc/traits/query/type_op/ascribe_user_type.rs index 259efb43de7..8b0ee5feed7 100644 --- a/src/librustc/traits/query/type_op/ascribe_user_type.rs +++ b/src/librustc/traits/query/type_op/ascribe_user_type.rs @@ -4,7 +4,7 @@ use crate::hir::def_id::DefId; use crate::ty::{ParamEnvAnd, Ty, TyCtxt}; use crate::ty::subst::UserSubsts; -#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, TypeFoldable)] +#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, TypeFoldable, Lift)] pub struct AscribeUserType<'tcx> { pub mir_ty: Ty<'tcx>, pub def_id: DefId, @@ -39,13 +39,6 @@ impl<'tcx> super::QueryTypeOp<'tcx> for AscribeUserType<'tcx> { } } -BraceStructLiftImpl! { - impl<'a, 'tcx> Lift<'tcx> for AscribeUserType<'a> { - type Lifted = AscribeUserType<'tcx>; - mir_ty, def_id, user_substs - } -} - impl_stable_hash_for! { struct AscribeUserType<'tcx> { mir_ty, def_id, user_substs diff --git a/src/librustc/traits/query/type_op/eq.rs b/src/librustc/traits/query/type_op/eq.rs index b51e8f89a31..5086994fbb6 100644 --- a/src/librustc/traits/query/type_op/eq.rs +++ b/src/librustc/traits/query/type_op/eq.rs @@ -2,7 +2,7 @@ use crate::infer::canonical::{Canonicalized, CanonicalizedQueryResponse}; use crate::traits::query::Fallible; use crate::ty::{ParamEnvAnd, Ty, TyCtxt}; -#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, TypeFoldable)] +#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, TypeFoldable, Lift)] pub struct Eq<'tcx> { pub a: Ty<'tcx>, pub b: Ty<'tcx>, @@ -36,14 +36,6 @@ impl<'tcx> super::QueryTypeOp<'tcx> for Eq<'tcx> { } } -BraceStructLiftImpl! { - impl<'a, 'tcx> Lift<'tcx> for Eq<'a> { - type Lifted = Eq<'tcx>; - a, - b, - } -} - impl_stable_hash_for! { struct Eq<'tcx> { a, b } } diff --git a/src/librustc/traits/query/type_op/implied_outlives_bounds.rs b/src/librustc/traits/query/type_op/implied_outlives_bounds.rs index 59d1920f68a..f97b34f9e9a 100644 --- a/src/librustc/traits/query/type_op/implied_outlives_bounds.rs +++ b/src/librustc/traits/query/type_op/implied_outlives_bounds.rs @@ -3,7 +3,7 @@ use crate::traits::query::outlives_bounds::OutlivesBound; use crate::traits::query::Fallible; use crate::ty::{ParamEnvAnd, Ty, TyCtxt}; -#[derive(Clone, Debug, TypeFoldable)] +#[derive(Clone, Debug, TypeFoldable, Lift)] pub struct ImpliedOutlivesBounds<'tcx> { pub ty: Ty<'tcx>, } @@ -40,13 +40,6 @@ impl<'tcx> super::QueryTypeOp<'tcx> for ImpliedOutlivesBounds<'tcx> { } } -BraceStructLiftImpl! { - impl<'a, 'tcx> Lift<'tcx> for ImpliedOutlivesBounds<'a> { - type Lifted = ImpliedOutlivesBounds<'tcx>; - ty, - } -} - impl_stable_hash_for! { struct ImpliedOutlivesBounds<'tcx> { ty } } diff --git a/src/librustc/traits/query/type_op/normalize.rs b/src/librustc/traits/query/type_op/normalize.rs index 5b8164c3a24..798fc5224cc 100644 --- a/src/librustc/traits/query/type_op/normalize.rs +++ b/src/librustc/traits/query/type_op/normalize.rs @@ -4,7 +4,7 @@ use crate::traits::query::Fallible; use crate::ty::fold::TypeFoldable; use crate::ty::{self, Lift, ParamEnvAnd, Ty, TyCtxt}; -#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, TypeFoldable)] +#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, TypeFoldable, Lift)] pub struct Normalize { pub value: T, } @@ -83,13 +83,6 @@ impl Normalizable<'tcx> for ty::FnSig<'tcx> { } } -BraceStructLiftImpl! { - impl<'tcx, T> Lift<'tcx> for Normalize { - type Lifted = Normalize; - value, - } where T: Lift<'tcx>, -} - impl_stable_hash_for! { impl for struct Normalize { value diff --git a/src/librustc/traits/query/type_op/outlives.rs b/src/librustc/traits/query/type_op/outlives.rs index 3d52452cf34..d2a7fdc8946 100644 --- a/src/librustc/traits/query/type_op/outlives.rs +++ b/src/librustc/traits/query/type_op/outlives.rs @@ -3,7 +3,7 @@ use crate::traits::query::dropck_outlives::{DropckOutlivesResult, trivial_dropck use crate::traits::query::Fallible; use crate::ty::{ParamEnvAnd, Ty, TyCtxt}; -#[derive(Copy, Clone, Debug, TypeFoldable)] +#[derive(Copy, Clone, Debug, TypeFoldable, Lift)] pub struct DropckOutlives<'tcx> { dropped_ty: Ty<'tcx>, } @@ -54,13 +54,6 @@ impl super::QueryTypeOp<'tcx> for DropckOutlives<'tcx> { } } -BraceStructLiftImpl! { - impl<'a, 'tcx> Lift<'tcx> for DropckOutlives<'a> { - type Lifted = DropckOutlives<'tcx>; - dropped_ty - } -} - impl_stable_hash_for! { struct DropckOutlives<'tcx> { dropped_ty } } diff --git a/src/librustc/traits/query/type_op/prove_predicate.rs b/src/librustc/traits/query/type_op/prove_predicate.rs index d0dd50326dd..cbf485fcfe0 100644 --- a/src/librustc/traits/query/type_op/prove_predicate.rs +++ b/src/librustc/traits/query/type_op/prove_predicate.rs @@ -2,7 +2,7 @@ use crate::infer::canonical::{Canonicalized, CanonicalizedQueryResponse}; use crate::traits::query::Fallible; use crate::ty::{ParamEnvAnd, Predicate, TyCtxt}; -#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, TypeFoldable)] +#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, TypeFoldable, Lift)] pub struct ProvePredicate<'tcx> { pub predicate: Predicate<'tcx>, } @@ -45,13 +45,6 @@ impl<'tcx> super::QueryTypeOp<'tcx> for ProvePredicate<'tcx> { } } -BraceStructLiftImpl! { - impl<'a, 'tcx> Lift<'tcx> for ProvePredicate<'a> { - type Lifted = ProvePredicate<'tcx>; - predicate, - } -} - impl_stable_hash_for! { struct ProvePredicate<'tcx> { predicate } } diff --git a/src/librustc/traits/query/type_op/subtype.rs b/src/librustc/traits/query/type_op/subtype.rs index 72ce91845c1..bd53e234a6a 100644 --- a/src/librustc/traits/query/type_op/subtype.rs +++ b/src/librustc/traits/query/type_op/subtype.rs @@ -2,7 +2,7 @@ use crate::infer::canonical::{Canonicalized, CanonicalizedQueryResponse}; use crate::traits::query::Fallible; use crate::ty::{ParamEnvAnd, Ty, TyCtxt}; -#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, TypeFoldable)] +#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, TypeFoldable, Lift)] pub struct Subtype<'tcx> { pub sub: Ty<'tcx>, pub sup: Ty<'tcx>, @@ -36,14 +36,6 @@ impl<'tcx> super::QueryTypeOp<'tcx> for Subtype<'tcx> { } } -BraceStructLiftImpl! { - impl<'a, 'tcx> Lift<'tcx> for Subtype<'a> { - type Lifted = Subtype<'tcx>; - sub, - sup, - } -} - impl_stable_hash_for! { struct Subtype<'tcx> { sub, sup } } diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index d9e6af7fe48..870a21c0489 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -826,20 +826,13 @@ rustc_index::newtype_index! { pub type CanonicalUserTypeAnnotations<'tcx> = IndexVec>; -#[derive(Clone, Debug, RustcEncodable, RustcDecodable, HashStable, TypeFoldable)] +#[derive(Clone, Debug, RustcEncodable, RustcDecodable, HashStable, TypeFoldable, Lift)] pub struct CanonicalUserTypeAnnotation<'tcx> { pub user_ty: CanonicalUserType<'tcx>, pub span: Span, pub inferred_ty: Ty<'tcx>, } -BraceStructLiftImpl! { - impl<'a, 'tcx> Lift<'tcx> for CanonicalUserTypeAnnotation<'a> { - type Lifted = CanonicalUserTypeAnnotation<'tcx>; - user_ty, span, inferred_ty - } -} - /// Canonicalized user type annotation. pub type CanonicalUserType<'tcx> = Canonical<'tcx, UserType<'tcx>>; diff --git a/src/librustc/ty/instance.rs b/src/librustc/ty/instance.rs index 5139c8085a5..7eee0a5e2b5 100644 --- a/src/librustc/ty/instance.rs +++ b/src/librustc/ty/instance.rs @@ -12,7 +12,8 @@ use rustc_macros::HashStable; use std::fmt; use std::iter; -#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable, HashStable)] +#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable)] +#[derive(HashStable, Lift)] pub struct Instance<'tcx> { pub def: InstanceDef<'tcx>, pub substs: SubstsRef<'tcx>, diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs index 578955575af..ccac7720914 100644 --- a/src/librustc/ty/structural_impls.rs +++ b/src/librustc/ty/structural_impls.rs @@ -1,7 +1,6 @@ //! This module contains implements of the `Lift` and `TypeFoldable` //! traits for various types in the Rust compiler. Most are written by -//! hand, though we've recently added some macros (e.g., -//! `BraceStructLiftImpl!`) to help with the tedium. +//! hand, though we've recently added some macros and proc-macros to help with the tedium. use crate::hir::def::Namespace; use crate::mir::ProjectionKind; @@ -779,27 +778,6 @@ impl<'a, 'tcx> Lift<'tcx> for ty::InstanceDef<'a> { } } -BraceStructLiftImpl! { - impl<'a, 'tcx> Lift<'tcx> for ty::TypeAndMut<'a> { - type Lifted = ty::TypeAndMut<'tcx>; - ty, mutbl - } -} - -BraceStructLiftImpl! { - impl<'a, 'tcx> Lift<'tcx> for ty::Instance<'a> { - type Lifted = ty::Instance<'tcx>; - def, substs - } -} - -BraceStructLiftImpl! { - impl<'a, 'tcx> Lift<'tcx> for interpret::GlobalId<'a> { - type Lifted = interpret::GlobalId<'tcx>; - instance, promoted - } -} - /////////////////////////////////////////////////////////////////////////// // TypeFoldable implementations. // diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 535d0e9584e..fa22709d66f 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -30,7 +30,7 @@ use self::InferTy::*; use self::TyKind::*; #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)] -#[derive(HashStable, TypeFoldable)] +#[derive(HashStable, TypeFoldable, Lift)] pub struct TypeAndMut<'tcx> { pub ty: Ty<'tcx>, pub mutbl: hir::Mutability, diff --git a/src/librustc/ty/subst.rs b/src/librustc/ty/subst.rs index 82216e8c73d..a8a17fe9d7d 100644 --- a/src/librustc/ty/subst.rs +++ b/src/librustc/ty/subst.rs @@ -731,7 +731,7 @@ pub type CanonicalUserSubsts<'tcx> = Canonical<'tcx, UserSubsts<'tcx>>; /// Stores the user-given substs to reach some fully qualified path /// (e.g., `::Item` or `::Item`). #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] -#[derive(HashStable, TypeFoldable)] +#[derive(HashStable, TypeFoldable, Lift)] pub struct UserSubsts<'tcx> { /// The substitutions for the item as given by the user. pub substs: SubstsRef<'tcx>, @@ -741,14 +741,6 @@ pub struct UserSubsts<'tcx> { pub user_self_ty: Option>, } -BraceStructLiftImpl! { - impl<'a, 'tcx> Lift<'tcx> for UserSubsts<'a> { - type Lifted = UserSubsts<'tcx>; - substs, - user_self_ty, - } -} - /// Specifies the user-given self type. In the case of a path that /// refers to a member in an inherent impl, this self type is /// sometimes needed to constrain the type parameters on the impl. For @@ -766,16 +758,8 @@ BraceStructLiftImpl! { /// the self type, giving `Foo`. Finally, we unify that with /// the self type here, which contains `?A` to be `&'static u32` #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] -#[derive(HashStable, TypeFoldable)] +#[derive(HashStable, TypeFoldable, Lift)] pub struct UserSelfTy<'tcx> { pub impl_def_id: DefId, pub self_ty: Ty<'tcx>, } - -BraceStructLiftImpl! { - impl<'a, 'tcx> Lift<'tcx> for UserSelfTy<'a> { - type Lifted = UserSelfTy<'tcx>; - impl_def_id, - self_ty, - } -} diff --git a/src/librustc_traits/chalk_context/mod.rs b/src/librustc_traits/chalk_context/mod.rs index e3ea2748737..b0dcdc7486e 100644 --- a/src/librustc_traits/chalk_context/mod.rs +++ b/src/librustc_traits/chalk_context/mod.rs @@ -38,7 +38,7 @@ use rustc::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor}; use rustc::ty::query::Providers; use rustc::ty::subst::{GenericArg, GenericArgKind}; use syntax_pos::DUMMY_SP; -use rustc_macros::TypeFoldable; +use rustc_macros::{TypeFoldable, Lift}; use std::fmt::{self, Debug}; use std::marker::PhantomData; @@ -66,7 +66,7 @@ crate struct UniverseMap; crate type RegionConstraint<'tcx> = ty::OutlivesPredicate, ty::Region<'tcx>>; -#[derive(Clone, Debug, PartialEq, Eq, Hash, TypeFoldable)] +#[derive(Clone, Debug, PartialEq, Eq, Hash, TypeFoldable, Lift)] crate struct ConstrainedSubst<'tcx> { subst: CanonicalVarValues<'tcx>, constraints: Vec>, @@ -581,14 +581,6 @@ impl ExClauseFold<'tcx> for ChalkArenas<'tcx> { } } -BraceStructLiftImpl! { - impl<'a, 'tcx> Lift<'tcx> for ConstrainedSubst<'a> { - type Lifted = ConstrainedSubst<'tcx>; - - subst, constraints - } -} - trait Upcast<'tcx>: 'tcx { type Upcasted: 'tcx;