Skip to content

Commit 39c966a

Browse files
committed
PR-Feedback; remove manual Lift implementations
1 parent d1727a7 commit 39c966a

5 files changed

Lines changed: 1 addition & 56 deletions

File tree

compiler/rustc_middle/src/ty/context.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,6 +1779,7 @@ macro_rules! nop_list_lift {
17791779

17801780
nop_lift! { type_; Ty<'a> => Ty<'tcx> }
17811781
nop_lift! { const_; Const<'a> => Const<'tcx> }
1782+
nop_lift! { region; Region<'a> => Region<'tcx> }
17821783
nop_lift! { pat; Pattern<'a> => Pattern<'tcx> }
17831784
nop_lift! { const_allocation; ConstAllocation<'a> => ConstAllocation<'tcx> }
17841785
nop_lift! { predicate; Predicate<'a> => Predicate<'tcx> }

compiler/rustc_middle/src/ty/structural_impls.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,16 +192,11 @@ TrivialLiftImpls! {
192192
crate::mir::Promoted,
193193
crate::mir::interpret::AllocId,
194194
crate::mir::interpret::Scalar,
195-
crate::ty::EarlyParamRegion,
196-
crate::ty::LateParamRegion,
197-
crate::ty::LateParamRegionKind,
198195
crate::ty::ParamConst,
199196
rustc_abi::ExternAbi,
200197
rustc_abi::Size,
201198
rustc_hir::Safety,
202199
rustc_middle::mir::ConstValue,
203-
rustc_span::ErrorGuaranteed,
204-
rustc_span::Symbol,
205200
rustc_type_ir::BoundConstness,
206201
rustc_type_ir::PredicatePolarity,
207202
// tidy-alphabetical-end

compiler/rustc_type_ir/src/binder.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,17 +1121,6 @@ pub struct BoundRegion<I: Interner> {
11211121
pub kind: BoundRegionKind<I>,
11221122
}
11231123

1124-
impl<I: Interner, U: Interner> Lift<U> for BoundRegion<I>
1125-
where
1126-
BoundRegionKind<I>: Lift<U, Lifted = BoundRegionKind<U>>,
1127-
{
1128-
type Lifted = BoundRegion<U>;
1129-
1130-
fn lift_to_interner(self, interner: U) -> Option<Self::Lifted> {
1131-
Some(BoundRegion { var: self.var, kind: self.kind.lift_to_interner(interner)? })
1132-
}
1133-
}
1134-
11351124
impl<I: Interner> core::fmt::Debug for BoundRegion<I> {
11361125
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11371126
match self.kind {

compiler/rustc_type_ir/src/region_kind.rs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use rustc_macros::{Decodable_NoContext, Encodable_NoContext};
88
use rustc_type_ir_macros::GenericTypeVisitable;
99

1010
use self::RegionKind::*;
11-
use crate::lift::Lift;
1211
use crate::{BoundRegion, BoundVarIndexKind, Interner, PlaceholderRegion};
1312

1413
rustc_index::newtype_index! {
@@ -188,33 +187,6 @@ pub enum RegionKind<I: Interner> {
188187

189188
impl<I: Interner> Eq for RegionKind<I> {}
190189

191-
impl<I: Interner, U: Interner> Lift<U> for RegionKind<I>
192-
where
193-
I::EarlyParamRegion: Lift<U, Lifted = U::EarlyParamRegion>,
194-
BoundRegion<I>: Lift<U, Lifted = BoundRegion<U>>,
195-
I::LateParamRegion: Lift<U, Lifted = U::LateParamRegion>,
196-
PlaceholderRegion<I>: Lift<U, Lifted = PlaceholderRegion<U>>,
197-
I::ErrorGuaranteed: Lift<U, Lifted = U::ErrorGuaranteed>,
198-
{
199-
type Lifted = RegionKind<U>;
200-
201-
fn lift_to_interner(self, interner: U) -> Option<Self::Lifted> {
202-
Some(match self {
203-
ReEarlyParam(region) => ReEarlyParam(region.lift_to_interner(interner)?),
204-
ReBound(index, region) => {
205-
ReBound(index.lift_to_interner(interner)?, region.lift_to_interner(interner)?)
206-
}
207-
ReLateParam(region) => ReLateParam(region.lift_to_interner(interner)?),
208-
ReStatic => ReStatic,
209-
// Inference vars are local to the originating inference context.
210-
ReVar(_) => return None,
211-
RePlaceholder(placeholder) => RePlaceholder(placeholder.lift_to_interner(interner)?),
212-
ReErased => ReErased,
213-
ReError(reported) => ReError(reported.lift_to_interner(interner)?),
214-
})
215-
}
216-
}
217-
218190
impl<I: Interner> fmt::Debug for RegionKind<I> {
219191
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
220192
match self {

compiler/rustc_type_ir/src/sty/mod.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use rustc_serialize::{Decodable, Encodable};
99
use tracing::debug;
1010

1111
use crate::inherent::*;
12-
use crate::lift::Lift;
1312
use crate::relate::{Relate, RelateResult, TypeRelation};
1413
use crate::{
1514
BoundRegion, BoundRegionKind, BoundVar, BoundVarIndexKind, DebruijnIndex, FallibleTypeFolder,
@@ -188,17 +187,6 @@ impl<I: Interner> TypeFoldable<I> for Region<I> {
188187
}
189188
}
190189

191-
impl<I: Interner, U: Interner> Lift<U> for Region<I>
192-
where
193-
RegionKind<I>: Lift<U, Lifted = RegionKind<U>>,
194-
{
195-
type Lifted = Region<U>;
196-
197-
fn lift_to_interner(self, interner: U) -> Option<Self::Lifted> {
198-
Some(interner.intern_region(self.kind().lift_to_interner(interner)?))
199-
}
200-
}
201-
202190
#[cfg(feature = "nightly")]
203191
impl<I: Interner, E: rustc_serialize::Encoder> Encodable<E> for Region<I>
204192
where

0 commit comments

Comments
 (0)