Simplify CloneLiftImpls and TrivialTypeTraversalImpls.
They both allow for a lifetime other than `'tcx`, but this isn't needed.
This commit is contained in:
@@ -400,10 +400,8 @@ pub type QueryOutlivesConstraint<'tcx> =
|
|||||||
(ty::OutlivesPredicate<GenericArg<'tcx>, Region<'tcx>>, ConstraintCategory<'tcx>);
|
(ty::OutlivesPredicate<GenericArg<'tcx>, Region<'tcx>>, ConstraintCategory<'tcx>);
|
||||||
|
|
||||||
TrivialTypeTraversalAndLiftImpls! {
|
TrivialTypeTraversalAndLiftImpls! {
|
||||||
for <'tcx> {
|
crate::infer::canonical::Certainty,
|
||||||
crate::infer::canonical::Certainty,
|
crate::infer::canonical::CanonicalTyVarKind,
|
||||||
crate::infer::canonical::CanonicalTyVarKind,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> CanonicalVarValues<'tcx> {
|
impl<'tcx> CanonicalVarValues<'tcx> {
|
||||||
|
|||||||
@@ -43,34 +43,26 @@ macro_rules! span_bug {
|
|||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! CloneLiftImpls {
|
macro_rules! CloneLiftImpls {
|
||||||
(for <$tcx:lifetime> { $($ty:ty,)+ }) => {
|
($($ty:ty,)+) => {
|
||||||
$(
|
$(
|
||||||
impl<$tcx> $crate::ty::Lift<$tcx> for $ty {
|
impl<'tcx> $crate::ty::Lift<'tcx> for $ty {
|
||||||
type Lifted = Self;
|
type Lifted = Self;
|
||||||
fn lift_to_tcx(self, _: $crate::ty::TyCtxt<$tcx>) -> Option<Self> {
|
fn lift_to_tcx(self, _: $crate::ty::TyCtxt<'tcx>) -> Option<Self> {
|
||||||
Some(self)
|
Some(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)+
|
)+
|
||||||
};
|
};
|
||||||
|
|
||||||
($($ty:ty,)+) => {
|
|
||||||
CloneLiftImpls! {
|
|
||||||
for <'tcx> {
|
|
||||||
$($ty,)+
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used for types that are `Copy` and which **do not care arena
|
/// Used for types that are `Copy` and which **do not care arena
|
||||||
/// allocated data** (i.e., don't need to be folded).
|
/// allocated data** (i.e., don't need to be folded).
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! TrivialTypeTraversalImpls {
|
macro_rules! TrivialTypeTraversalImpls {
|
||||||
(for <$tcx:lifetime> { $($ty:ty,)+ }) => {
|
($($ty:ty,)+) => {
|
||||||
$(
|
$(
|
||||||
impl<$tcx> $crate::ty::fold::TypeFoldable<$crate::ty::TyCtxt<$tcx>> for $ty {
|
impl<'tcx> $crate::ty::fold::TypeFoldable<$crate::ty::TyCtxt<'tcx>> for $ty {
|
||||||
fn try_fold_with<F: $crate::ty::fold::FallibleTypeFolder<$crate::ty::TyCtxt<$tcx>>>(
|
fn try_fold_with<F: $crate::ty::fold::FallibleTypeFolder<$crate::ty::TyCtxt<'tcx>>>(
|
||||||
self,
|
self,
|
||||||
_: &mut F,
|
_: &mut F,
|
||||||
) -> ::std::result::Result<Self, F::Error> {
|
) -> ::std::result::Result<Self, F::Error> {
|
||||||
@@ -78,7 +70,7 @@ macro_rules! TrivialTypeTraversalImpls {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn fold_with<F: $crate::ty::fold::TypeFolder<$crate::ty::TyCtxt<$tcx>>>(
|
fn fold_with<F: $crate::ty::fold::TypeFolder<$crate::ty::TyCtxt<'tcx>>>(
|
||||||
self,
|
self,
|
||||||
_: &mut F,
|
_: &mut F,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
@@ -86,9 +78,9 @@ macro_rules! TrivialTypeTraversalImpls {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<$tcx> $crate::ty::visit::TypeVisitable<$crate::ty::TyCtxt<$tcx>> for $ty {
|
impl<'tcx> $crate::ty::visit::TypeVisitable<$crate::ty::TyCtxt<'tcx>> for $ty {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn visit_with<F: $crate::ty::visit::TypeVisitor<$crate::ty::TyCtxt<$tcx>>>(
|
fn visit_with<F: $crate::ty::visit::TypeVisitor<$crate::ty::TyCtxt<'tcx>>>(
|
||||||
&self,
|
&self,
|
||||||
_: &mut F)
|
_: &mut F)
|
||||||
-> ::std::ops::ControlFlow<F::BreakTy>
|
-> ::std::ops::ControlFlow<F::BreakTy>
|
||||||
@@ -98,14 +90,6 @@ macro_rules! TrivialTypeTraversalImpls {
|
|||||||
}
|
}
|
||||||
)+
|
)+
|
||||||
};
|
};
|
||||||
|
|
||||||
($($ty:ty,)+) => {
|
|
||||||
TrivialTypeTraversalImpls! {
|
|
||||||
for<'tcx> {
|
|
||||||
$($ty,)+
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
|
|||||||
@@ -714,9 +714,7 @@ pub enum BindingForm<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TrivialTypeTraversalAndLiftImpls! {
|
TrivialTypeTraversalAndLiftImpls! {
|
||||||
for<'tcx> {
|
BindingForm<'tcx>,
|
||||||
BindingForm<'tcx>,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mod binding_form_impl {
|
mod binding_form_impl {
|
||||||
|
|||||||
@@ -25,9 +25,7 @@ TrivialTypeTraversalAndLiftImpls! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TrivialTypeTraversalImpls! {
|
TrivialTypeTraversalImpls! {
|
||||||
for <'tcx> {
|
ConstValue<'tcx>,
|
||||||
ConstValue<'tcx>,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for &'tcx [InlineAsmTemplatePiece] {
|
impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for &'tcx [InlineAsmTemplatePiece] {
|
||||||
|
|||||||
@@ -1329,9 +1329,12 @@ 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> {
|
CloneLiftImpls! {
|
||||||
Constness, traits::WellFormedLoc, ImplPolarity, crate::mir::ReturnConstraint,
|
Constness,
|
||||||
} }
|
traits::WellFormedLoc,
|
||||||
|
ImplPolarity,
|
||||||
|
crate::mir::ReturnConstraint,
|
||||||
|
}
|
||||||
|
|
||||||
macro_rules! sty_debug_print {
|
macro_rules! sty_debug_print {
|
||||||
($fmt: expr, $ctxt: expr, $($variant: ident),*) => {{
|
($fmt: expr, $ctxt: expr, $($variant: ident),*) => {{
|
||||||
|
|||||||
@@ -276,9 +276,7 @@ TrivialTypeTraversalAndLiftImpls! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TrivialTypeTraversalAndLiftImpls! {
|
TrivialTypeTraversalAndLiftImpls! {
|
||||||
for<'tcx> {
|
ty::ValTree<'tcx>,
|
||||||
ty::ValTree<'tcx>,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user