Skip to content

Commit 24bb884

Browse files
committed
Auto merge of rust-lang#115831 - nnethercote:remove-unused-Lift-impls, r=bjorn3
Remove unused `Lift` impls r? `@bjorn3`
2 parents df99bc1 + abe2a68 commit 24bb884

File tree

31 files changed

+108
-212
lines changed

31 files changed

+108
-212
lines changed

compiler/rustc_borrowck/src/diagnostics/region_name.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,8 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
442442
span: Span,
443443
counter: usize,
444444
) -> RegionNameHighlight {
445-
let mut highlight = RegionHighlightMode::new(self.infcx.tcx);
446-
highlight.highlighting_region_vid(needle_fr, counter);
445+
let mut highlight = RegionHighlightMode::default();
446+
highlight.highlighting_region_vid(self.infcx.tcx, needle_fr, counter);
447447
let type_name =
448448
self.infcx.extract_inference_diagnostics_data(ty.into(), Some(highlight)).name;
449449

@@ -804,8 +804,8 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
804804
return None;
805805
}
806806

807-
let mut highlight = RegionHighlightMode::new(tcx);
808-
highlight.highlighting_region_vid(fr, *self.next_region_name.try_borrow().unwrap());
807+
let mut highlight = RegionHighlightMode::default();
808+
highlight.highlighting_region_vid(tcx, fr, *self.next_region_name.try_borrow().unwrap());
809809
let type_name =
810810
self.infcx.extract_inference_diagnostics_data(yield_ty.into(), Some(highlight)).name;
811811

compiler/rustc_infer/src/infer/error_reporting/nice_region_error/placeholder_error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ impl<'tcx> NiceRegionError<'_, 'tcx> {
385385

386386
let highlight_trait_ref = |trait_ref| Highlighted {
387387
tcx: self.tcx(),
388-
highlight: RegionHighlightMode::new(self.tcx()),
388+
highlight: RegionHighlightMode::default(),
389389
value: trait_ref,
390390
};
391391

compiler/rustc_infer/src/infer/error_reporting/nice_region_error/trait_impl_difference.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
6767
}
6868

6969
impl<'tcx> HighlightBuilder<'tcx> {
70-
fn build(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> RegionHighlightMode<'tcx> {
70+
fn build(ty: Ty<'tcx>) -> RegionHighlightMode<'tcx> {
7171
let mut builder =
72-
HighlightBuilder { highlight: RegionHighlightMode::new(tcx), counter: 1 };
72+
HighlightBuilder { highlight: RegionHighlightMode::default(), counter: 1 };
7373
builder.visit_ty(ty);
7474
builder.highlight
7575
}
@@ -85,12 +85,12 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
8585
}
8686
}
8787

88-
let expected_highlight = HighlightBuilder::build(self.tcx(), expected);
88+
let expected_highlight = HighlightBuilder::build(expected);
8989
let expected = self
9090
.cx
9191
.extract_inference_diagnostics_data(expected.into(), Some(expected_highlight))
9292
.name;
93-
let found_highlight = HighlightBuilder::build(self.tcx(), found);
93+
let found_highlight = HighlightBuilder::build(found);
9494
let found =
9595
self.cx.extract_inference_diagnostics_data(found.into(), Some(found_highlight)).name;
9696

compiler/rustc_infer/src/infer/free_regions.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! and use that to decide when one free region outlives another, and so forth.
55
66
use rustc_data_structures::transitive_relation::TransitiveRelation;
7-
use rustc_middle::ty::{Lift, Region, TyCtxt};
7+
use rustc_middle::ty::{Region, TyCtxt};
88

99
/// Combines a `FreeRegionMap` and a `TyCtxt`.
1010
///
@@ -101,10 +101,3 @@ impl<'tcx> FreeRegionMap<'tcx> {
101101
result
102102
}
103103
}
104-
105-
impl<'a, 'tcx> Lift<'tcx> for FreeRegionMap<'a> {
106-
type Lifted = FreeRegionMap<'tcx>;
107-
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<FreeRegionMap<'tcx>> {
108-
self.relation.maybe_map(|fr| tcx.lift(fr)).map(|relation| FreeRegionMap { relation })
109-
}
110-
}

compiler/rustc_middle/src/infer/canonical.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use std::ops::Index;
3434
/// variables have been rewritten to "canonical vars". These are
3535
/// numbered starting from 0 in order of first appearance.
3636
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, TyDecodable, TyEncodable)]
37-
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
37+
#[derive(HashStable, TypeFoldable, TypeVisitable)]
3838
pub struct Canonical<'tcx, V> {
3939
pub value: V,
4040
pub max_universe: ty::UniverseIndex,
@@ -72,7 +72,7 @@ impl<'tcx> ty::TypeFoldable<TyCtxt<'tcx>> for CanonicalVarInfos<'tcx> {
7272
/// variables. You will need to supply it later to instantiate the
7373
/// canonicalized query response.
7474
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, TyDecodable, TyEncodable)]
75-
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
75+
#[derive(HashStable, TypeFoldable, TypeVisitable)]
7676
pub struct CanonicalVarValues<'tcx> {
7777
pub var_values: ty::GenericArgsRef<'tcx>,
7878
}
@@ -311,7 +311,7 @@ pub enum CanonicalTyVarKind {
311311
/// After we execute a query with a canonicalized key, we get back a
312312
/// `Canonical<QueryResponse<..>>`. You can use
313313
/// `instantiate_query_result` to access the data in this result.
314-
#[derive(Clone, Debug, HashStable, TypeFoldable, TypeVisitable, Lift)]
314+
#[derive(Clone, Debug, HashStable, TypeFoldable, TypeVisitable)]
315315
pub struct QueryResponse<'tcx, R> {
316316
pub var_values: CanonicalVarValues<'tcx>,
317317
pub region_constraints: QueryRegionConstraints<'tcx>,
@@ -326,7 +326,7 @@ pub struct QueryResponse<'tcx, R> {
326326
}
327327

328328
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
329-
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
329+
#[derive(HashStable, TypeFoldable, TypeVisitable)]
330330
pub struct QueryRegionConstraints<'tcx> {
331331
pub outlives: Vec<QueryOutlivesConstraint<'tcx>>,
332332
pub member_constraints: Vec<MemberConstraint<'tcx>>,
@@ -432,7 +432,7 @@ impl<'tcx, V> Canonical<'tcx, V> {
432432
pub type QueryOutlivesConstraint<'tcx> =
433433
(ty::OutlivesPredicate<GenericArg<'tcx>, Region<'tcx>>, ConstraintCategory<'tcx>);
434434

435-
TrivialTypeTraversalAndLiftImpls! {
435+
TrivialTypeTraversalImpls! {
436436
crate::infer::canonical::Certainty,
437437
crate::infer::canonical::CanonicalTyVarKind,
438438
}

compiler/rustc_middle/src/infer/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use rustc_span::Span;
1313
/// R0 member of [O1..On]
1414
/// ```
1515
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
16-
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
16+
#[derive(HashStable, TypeFoldable, TypeVisitable)]
1717
pub struct MemberConstraint<'tcx> {
1818
/// The `DefId` and args of the opaque type causing this constraint.
1919
/// Used for error reporting.

compiler/rustc_middle/src/macros.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ macro_rules! span_bug {
4242
// the impls for you.
4343

4444
#[macro_export]
45-
macro_rules! CloneLiftImpls {
45+
macro_rules! TrivialLiftImpls {
4646
($($ty:ty),+ $(,)?) => {
4747
$(
4848
impl<'tcx> $crate::ty::Lift<'tcx> for $ty {
@@ -96,6 +96,6 @@ macro_rules! TrivialTypeTraversalImpls {
9696
macro_rules! TrivialTypeTraversalAndLiftImpls {
9797
($($t:tt)*) => {
9898
TrivialTypeTraversalImpls! { $($t)* }
99-
CloneLiftImpls! { $($t)* }
99+
TrivialLiftImpls! { $($t)* }
100100
}
101101
}

compiler/rustc_middle/src/mir/basic_blocks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ impl<'tcx> graph::WithPredecessors for BasicBlocks<'tcx> {
178178
}
179179
}
180180

181-
TrivialTypeTraversalAndLiftImpls! { Cache }
181+
TrivialTypeTraversalImpls! { Cache }
182182

183183
impl<S: Encoder> Encodable<S> for Cache {
184184
#[inline]

compiler/rustc_middle/src/mir/interpret/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl Into<ErrorGuaranteed> for ReportedErrorInfo {
6767
}
6868
}
6969

70-
TrivialTypeTraversalAndLiftImpls! { ErrorHandled }
70+
TrivialTypeTraversalImpls! { ErrorHandled }
7171

7272
pub type EvalToAllocationRawResult<'tcx> = Result<ConstAlloc<'tcx>, ErrorHandled>;
7373
pub type EvalToConstValueResult<'tcx> = Result<ConstValue<'tcx>, ErrorHandled>;

compiler/rustc_middle/src/mir/interpret/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ pub use self::pointer::{Pointer, PointerArithmetic, Provenance};
162162
/// - A constant
163163
/// - A static
164164
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, TyEncodable, TyDecodable)]
165-
#[derive(HashStable, Lift, TypeFoldable, TypeVisitable)]
165+
#[derive(HashStable, TypeFoldable, TypeVisitable)]
166166
pub struct GlobalId<'tcx> {
167167
/// For a constant or static, the `Instance` of the item itself.
168168
/// For a promoted global, the `Instance` of the function they belong to.

0 commit comments

Comments
 (0)