Skip to content

Commit 21ac960

Browse files
committed
rustc: remove some unnecessary lifetimes in -> TyCtxt methods.
1 parent 17cdd35 commit 21ac960

File tree

14 files changed

+28
-41
lines changed

14 files changed

+28
-41
lines changed

src/librustc/lint/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> {
793793
type DynExistential = ();
794794
type Const = ();
795795

796-
fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> {
796+
fn tcx(&self) -> TyCtxt<'tcx, 'tcx> {
797797
self.tcx
798798
}
799799

src/librustc/mir/interpret/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ pub struct AllocDecodingSession<'s> {
144144
impl<'s> AllocDecodingSession<'s> {
145145

146146
// Decodes an AllocId in a thread-safe way.
147-
pub fn decode_alloc_id<'tcx, D>(&self,
147+
pub fn decode_alloc_id<D>(&self,
148148
decoder: &mut D)
149149
-> Result<AllocId, D::Error>
150150
where D: TyDecoder<'tcx>,

src/librustc/traits/query/normalize_erasing_regions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ struct NormalizeAfterErasingRegionsFolder<'tcx> {
6868
}
6969

7070
impl TypeFolder<'tcx, 'tcx> for NormalizeAfterErasingRegionsFolder<'tcx> {
71-
fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> {
71+
fn tcx(&self) -> TyCtxt<'tcx, 'tcx> {
7272
self.tcx
7373
}
7474

src/librustc/ty/codec.rs

+13-26
Original file line numberDiff line numberDiff line change
@@ -131,38 +131,34 @@ pub trait TyDecoder<'tcx>: Decoder {
131131
}
132132

133133
#[inline]
134-
pub fn decode_arena_allocable<'a, 'tcx, D, T: ArenaAllocatable + Decodable>(
134+
pub fn decode_arena_allocable<D, T: ArenaAllocatable + Decodable>(
135135
decoder: &mut D
136136
) -> Result<&'tcx T, D::Error>
137137
where D: TyDecoder<'tcx>,
138-
'tcx: 'a,
139138
{
140139
Ok(decoder.tcx().arena.alloc(Decodable::decode(decoder)?))
141140
}
142141

143142
#[inline]
144-
pub fn decode_arena_allocable_slice<'a, 'tcx, D, T: ArenaAllocatable + Decodable>(
143+
pub fn decode_arena_allocable_slice<D, T: ArenaAllocatable + Decodable>(
145144
decoder: &mut D
146145
) -> Result<&'tcx [T], D::Error>
147146
where D: TyDecoder<'tcx>,
148-
'tcx: 'a,
149147
{
150148
Ok(decoder.tcx().arena.alloc_from_iter(<Vec<T> as Decodable>::decode(decoder)?))
151149
}
152150

153151
#[inline]
154-
pub fn decode_cnum<'a, 'tcx, D>(decoder: &mut D) -> Result<CrateNum, D::Error>
152+
pub fn decode_cnum<D>(decoder: &mut D) -> Result<CrateNum, D::Error>
155153
where D: TyDecoder<'tcx>,
156-
'tcx: 'a,
157154
{
158155
let cnum = CrateNum::from_u32(u32::decode(decoder)?);
159156
Ok(decoder.map_encoded_cnum_to_current(cnum))
160157
}
161158

162159
#[inline]
163-
pub fn decode_ty<'a, 'tcx, D>(decoder: &mut D) -> Result<Ty<'tcx>, D::Error>
160+
pub fn decode_ty<D>(decoder: &mut D) -> Result<Ty<'tcx>, D::Error>
164161
where D: TyDecoder<'tcx>,
165-
'tcx: 'a,
166162
{
167163
// Handle shorthands first, if we have an usize > 0x80.
168164
if decoder.positioned_at_shorthand() {
@@ -180,10 +176,9 @@ pub fn decode_ty<'a, 'tcx, D>(decoder: &mut D) -> Result<Ty<'tcx>, D::Error>
180176
}
181177

182178
#[inline]
183-
pub fn decode_predicates<'a, 'tcx, D>(decoder: &mut D)
179+
pub fn decode_predicates<D>(decoder: &mut D)
184180
-> Result<ty::GenericPredicates<'tcx>, D::Error>
185181
where D: TyDecoder<'tcx>,
186-
'tcx: 'a,
187182
{
188183
Ok(ty::GenericPredicates {
189184
parent: Decodable::decode(decoder)?,
@@ -205,59 +200,53 @@ pub fn decode_predicates<'a, 'tcx, D>(decoder: &mut D)
205200
}
206201

207202
#[inline]
208-
pub fn decode_substs<'a, 'tcx, D>(decoder: &mut D) -> Result<SubstsRef<'tcx>, D::Error>
203+
pub fn decode_substs<D>(decoder: &mut D) -> Result<SubstsRef<'tcx>, D::Error>
209204
where D: TyDecoder<'tcx>,
210-
'tcx: 'a,
211205
{
212206
let len = decoder.read_usize()?;
213207
let tcx = decoder.tcx();
214208
Ok(tcx.mk_substs((0..len).map(|_| Decodable::decode(decoder)))?)
215209
}
216210

217211
#[inline]
218-
pub fn decode_region<'a, 'tcx, D>(decoder: &mut D) -> Result<ty::Region<'tcx>, D::Error>
212+
pub fn decode_region<D>(decoder: &mut D) -> Result<ty::Region<'tcx>, D::Error>
219213
where D: TyDecoder<'tcx>,
220-
'tcx: 'a,
221214
{
222215
Ok(decoder.tcx().mk_region(Decodable::decode(decoder)?))
223216
}
224217

225218
#[inline]
226-
pub fn decode_ty_slice<'a, 'tcx, D>(decoder: &mut D)
219+
pub fn decode_ty_slice<D>(decoder: &mut D)
227220
-> Result<&'tcx ty::List<Ty<'tcx>>, D::Error>
228221
where D: TyDecoder<'tcx>,
229-
'tcx: 'a,
230222
{
231223
let len = decoder.read_usize()?;
232224
Ok(decoder.tcx().mk_type_list((0..len).map(|_| Decodable::decode(decoder)))?)
233225
}
234226

235227
#[inline]
236-
pub fn decode_adt_def<'a, 'tcx, D>(decoder: &mut D)
228+
pub fn decode_adt_def<D>(decoder: &mut D)
237229
-> Result<&'tcx ty::AdtDef, D::Error>
238230
where D: TyDecoder<'tcx>,
239-
'tcx: 'a,
240231
{
241232
let def_id = DefId::decode(decoder)?;
242233
Ok(decoder.tcx().adt_def(def_id))
243234
}
244235

245236
#[inline]
246-
pub fn decode_existential_predicate_slice<'a, 'tcx, D>(decoder: &mut D)
237+
pub fn decode_existential_predicate_slice<D>(decoder: &mut D)
247238
-> Result<&'tcx ty::List<ty::ExistentialPredicate<'tcx>>, D::Error>
248239
where D: TyDecoder<'tcx>,
249-
'tcx: 'a,
250240
{
251241
let len = decoder.read_usize()?;
252242
Ok(decoder.tcx()
253243
.mk_existential_predicates((0..len).map(|_| Decodable::decode(decoder)))?)
254244
}
255245

256246
#[inline]
257-
pub fn decode_canonical_var_infos<'a, 'tcx, D>(decoder: &mut D)
247+
pub fn decode_canonical_var_infos<D>(decoder: &mut D)
258248
-> Result<CanonicalVarInfos<'tcx>, D::Error>
259249
where D: TyDecoder<'tcx>,
260-
'tcx: 'a,
261250
{
262251
let len = decoder.read_usize()?;
263252
let interned: Result<Vec<CanonicalVarInfo>, _> = (0..len).map(|_| Decodable::decode(decoder))
@@ -267,19 +256,17 @@ pub fn decode_canonical_var_infos<'a, 'tcx, D>(decoder: &mut D)
267256
}
268257

269258
#[inline]
270-
pub fn decode_const<'a, 'tcx, D>(decoder: &mut D)
259+
pub fn decode_const<D>(decoder: &mut D)
271260
-> Result<&'tcx ty::Const<'tcx>, D::Error>
272261
where D: TyDecoder<'tcx>,
273-
'tcx: 'a,
274262
{
275263
Ok(decoder.tcx().mk_const(Decodable::decode(decoder)?))
276264
}
277265

278266
#[inline]
279-
pub fn decode_allocation<'a, 'tcx, D>(decoder: &mut D)
267+
pub fn decode_allocation<D>(decoder: &mut D)
280268
-> Result<&'tcx Allocation, D::Error>
281269
where D: TyDecoder<'tcx>,
282-
'tcx: 'a,
283270
{
284271
Ok(decoder.tcx().intern_const_alloc(Decodable::decode(decoder)?))
285272
}

src/librustc/ty/layout.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1727,7 +1727,7 @@ impl<'tcx> SizeSkeleton<'tcx> {
17271727
}
17281728

17291729
pub trait HasTyCtxt<'tcx>: HasDataLayout {
1730-
fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx>;
1730+
fn tcx(&self) -> TyCtxt<'tcx, 'tcx>;
17311731
}
17321732

17331733
pub trait HasParamEnv<'tcx> {
@@ -1741,7 +1741,7 @@ impl<'gcx, 'tcx> HasDataLayout for TyCtxt<'gcx, 'tcx> {
17411741
}
17421742

17431743
impl<'gcx, 'tcx> HasTyCtxt<'gcx> for TyCtxt<'gcx, 'tcx> {
1744-
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'gcx> {
1744+
fn tcx(&self) -> TyCtxt<'gcx, 'gcx> {
17451745
self.global_tcx()
17461746
}
17471747
}
@@ -1759,7 +1759,7 @@ impl<'tcx, T: HasDataLayout> HasDataLayout for LayoutCx<'tcx, T> {
17591759
}
17601760

17611761
impl<'gcx, 'tcx, T: HasTyCtxt<'gcx>> HasTyCtxt<'gcx> for LayoutCx<'tcx, T> {
1762-
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'gcx> {
1762+
fn tcx(&self) -> TyCtxt<'gcx, 'gcx> {
17631763
self.tcx.tcx()
17641764
}
17651765
}

src/librustc_codegen_llvm/builder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl ty::layout::HasDataLayout for Builder<'_, '_, '_> {
6666
}
6767

6868
impl ty::layout::HasTyCtxt<'tcx> for Builder<'_, '_, 'tcx> {
69-
fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> {
69+
fn tcx(&self) -> TyCtxt<'tcx, 'tcx> {
7070
self.cx.tcx
7171
}
7272
}

src/librustc_codegen_llvm/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ impl HasTargetSpec for CodegenCx<'ll, 'tcx> {
838838
}
839839

840840
impl ty::layout::HasTyCtxt<'tcx> for CodegenCx<'ll, 'tcx> {
841-
fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> {
841+
fn tcx(&self) -> TyCtxt<'tcx, 'tcx> {
842842
self.tcx
843843
}
844844
}

src/librustc_codegen_utils/symbol_names/legacy.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ impl Printer<'tcx, 'tcx> for SymbolPrinter<'tcx> {
203203
type DynExistential = Self;
204204
type Const = Self;
205205

206-
fn tcx(&'a self) -> TyCtxt<'tcx, 'tcx> {
206+
fn tcx(&self) -> TyCtxt<'tcx, 'tcx> {
207207
self.tcx
208208
}
209209

src/librustc_codegen_utils/symbol_names/v0.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ impl Printer<'tcx, 'tcx> for SymbolMangler<'tcx> {
223223
type DynExistential = Self;
224224
type Const = Self;
225225

226-
fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> {
226+
fn tcx(&self) -> TyCtxt<'tcx, 'tcx> {
227227
self.tcx
228228
}
229229

src/librustc_mir/interpret/eval_context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ impl<'mir, 'tcx, M> layout::HasTyCtxt<'tcx> for InterpretCx<'mir, 'tcx, M>
173173
where M: Machine<'mir, 'tcx>
174174
{
175175
#[inline]
176-
fn tcx<'d>(&'d self) -> TyCtxt<'tcx, 'tcx> {
176+
fn tcx(&self) -> TyCtxt<'tcx, 'tcx> {
177177
*self.tcx
178178
}
179179
}

src/librustc_mir/interpret/intrinsics/type_name.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl<'tcx> Printer<'tcx, 'tcx> for AbsolutePathPrinter<'tcx> {
2323
type DynExistential = Self;
2424
type Const = Self;
2525

26-
fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> {
26+
fn tcx(&self) -> TyCtxt<'tcx, 'tcx> {
2727
self.tcx
2828
}
2929

src/librustc_mir/transform/const_prop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl<'mir, 'tcx> HasDataLayout for ConstPropagator<'mir, 'tcx> {
113113

114114
impl<'mir, 'tcx> HasTyCtxt<'tcx> for ConstPropagator<'mir, 'tcx> {
115115
#[inline]
116-
fn tcx<'c>(&'c self) -> TyCtxt<'tcx, 'tcx> {
116+
fn tcx(&self) -> TyCtxt<'tcx, 'tcx> {
117117
self.tcx
118118
}
119119
}

src/librustc_passes/layout_test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ impl LayoutOf for UnwrapLayoutCx<'tcx> {
119119
}
120120

121121
impl HasTyCtxt<'tcx> for UnwrapLayoutCx<'tcx> {
122-
fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> {
122+
fn tcx(&self) -> TyCtxt<'tcx, 'tcx> {
123123
self.tcx
124124
}
125125
}

src/librustc_typeck/collect.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl ItemCtxt<'tcx> {
171171
}
172172

173173
impl AstConv<'tcx, 'tcx> for ItemCtxt<'tcx> {
174-
fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'tcx> {
174+
fn tcx(&self) -> TyCtxt<'tcx, 'tcx> {
175175
self.tcx
176176
}
177177

0 commit comments

Comments
 (0)