rustc: remove some unnecessary lifetimes in -> TyCtxt methods.
This commit is contained in:
parent
17cdd356da
commit
21ac960334
14 changed files with 28 additions and 41 deletions
|
@ -793,7 +793,7 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> {
|
|||
type DynExistential = ();
|
||||
type Const = ();
|
||||
|
||||
fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'tcx, 'tcx> {
|
||||
self.tcx
|
||||
}
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ pub struct AllocDecodingSession<'s> {
|
|||
impl<'s> AllocDecodingSession<'s> {
|
||||
|
||||
// Decodes an AllocId in a thread-safe way.
|
||||
pub fn decode_alloc_id<'tcx, D>(&self,
|
||||
pub fn decode_alloc_id<D>(&self,
|
||||
decoder: &mut D)
|
||||
-> Result<AllocId, D::Error>
|
||||
where D: TyDecoder<'tcx>,
|
||||
|
|
|
@ -68,7 +68,7 @@ struct NormalizeAfterErasingRegionsFolder<'tcx> {
|
|||
}
|
||||
|
||||
impl TypeFolder<'tcx, 'tcx> for NormalizeAfterErasingRegionsFolder<'tcx> {
|
||||
fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'tcx, 'tcx> {
|
||||
self.tcx
|
||||
}
|
||||
|
||||
|
|
|
@ -131,38 +131,34 @@ pub trait TyDecoder<'tcx>: Decoder {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn decode_arena_allocable<'a, 'tcx, D, T: ArenaAllocatable + Decodable>(
|
||||
pub fn decode_arena_allocable<D, T: ArenaAllocatable + Decodable>(
|
||||
decoder: &mut D
|
||||
) -> Result<&'tcx T, D::Error>
|
||||
where D: TyDecoder<'tcx>,
|
||||
'tcx: 'a,
|
||||
{
|
||||
Ok(decoder.tcx().arena.alloc(Decodable::decode(decoder)?))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn decode_arena_allocable_slice<'a, 'tcx, D, T: ArenaAllocatable + Decodable>(
|
||||
pub fn decode_arena_allocable_slice<D, T: ArenaAllocatable + Decodable>(
|
||||
decoder: &mut D
|
||||
) -> Result<&'tcx [T], D::Error>
|
||||
where D: TyDecoder<'tcx>,
|
||||
'tcx: 'a,
|
||||
{
|
||||
Ok(decoder.tcx().arena.alloc_from_iter(<Vec<T> as Decodable>::decode(decoder)?))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn decode_cnum<'a, 'tcx, D>(decoder: &mut D) -> Result<CrateNum, D::Error>
|
||||
pub fn decode_cnum<D>(decoder: &mut D) -> Result<CrateNum, D::Error>
|
||||
where D: TyDecoder<'tcx>,
|
||||
'tcx: 'a,
|
||||
{
|
||||
let cnum = CrateNum::from_u32(u32::decode(decoder)?);
|
||||
Ok(decoder.map_encoded_cnum_to_current(cnum))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn decode_ty<'a, 'tcx, D>(decoder: &mut D) -> Result<Ty<'tcx>, D::Error>
|
||||
pub fn decode_ty<D>(decoder: &mut D) -> Result<Ty<'tcx>, D::Error>
|
||||
where D: TyDecoder<'tcx>,
|
||||
'tcx: 'a,
|
||||
{
|
||||
// Handle shorthands first, if we have an usize > 0x80.
|
||||
if decoder.positioned_at_shorthand() {
|
||||
|
@ -180,10 +176,9 @@ pub fn decode_ty<'a, 'tcx, D>(decoder: &mut D) -> Result<Ty<'tcx>, D::Error>
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn decode_predicates<'a, 'tcx, D>(decoder: &mut D)
|
||||
pub fn decode_predicates<D>(decoder: &mut D)
|
||||
-> Result<ty::GenericPredicates<'tcx>, D::Error>
|
||||
where D: TyDecoder<'tcx>,
|
||||
'tcx: 'a,
|
||||
{
|
||||
Ok(ty::GenericPredicates {
|
||||
parent: Decodable::decode(decoder)?,
|
||||
|
@ -205,9 +200,8 @@ pub fn decode_predicates<'a, 'tcx, D>(decoder: &mut D)
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn decode_substs<'a, 'tcx, D>(decoder: &mut D) -> Result<SubstsRef<'tcx>, D::Error>
|
||||
pub fn decode_substs<D>(decoder: &mut D) -> Result<SubstsRef<'tcx>, D::Error>
|
||||
where D: TyDecoder<'tcx>,
|
||||
'tcx: 'a,
|
||||
{
|
||||
let len = decoder.read_usize()?;
|
||||
let tcx = decoder.tcx();
|
||||
|
@ -215,38 +209,34 @@ pub fn decode_substs<'a, 'tcx, D>(decoder: &mut D) -> Result<SubstsRef<'tcx>, D:
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn decode_region<'a, 'tcx, D>(decoder: &mut D) -> Result<ty::Region<'tcx>, D::Error>
|
||||
pub fn decode_region<D>(decoder: &mut D) -> Result<ty::Region<'tcx>, D::Error>
|
||||
where D: TyDecoder<'tcx>,
|
||||
'tcx: 'a,
|
||||
{
|
||||
Ok(decoder.tcx().mk_region(Decodable::decode(decoder)?))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn decode_ty_slice<'a, 'tcx, D>(decoder: &mut D)
|
||||
pub fn decode_ty_slice<D>(decoder: &mut D)
|
||||
-> Result<&'tcx ty::List<Ty<'tcx>>, D::Error>
|
||||
where D: TyDecoder<'tcx>,
|
||||
'tcx: 'a,
|
||||
{
|
||||
let len = decoder.read_usize()?;
|
||||
Ok(decoder.tcx().mk_type_list((0..len).map(|_| Decodable::decode(decoder)))?)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn decode_adt_def<'a, 'tcx, D>(decoder: &mut D)
|
||||
pub fn decode_adt_def<D>(decoder: &mut D)
|
||||
-> Result<&'tcx ty::AdtDef, D::Error>
|
||||
where D: TyDecoder<'tcx>,
|
||||
'tcx: 'a,
|
||||
{
|
||||
let def_id = DefId::decode(decoder)?;
|
||||
Ok(decoder.tcx().adt_def(def_id))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn decode_existential_predicate_slice<'a, 'tcx, D>(decoder: &mut D)
|
||||
pub fn decode_existential_predicate_slice<D>(decoder: &mut D)
|
||||
-> Result<&'tcx ty::List<ty::ExistentialPredicate<'tcx>>, D::Error>
|
||||
where D: TyDecoder<'tcx>,
|
||||
'tcx: 'a,
|
||||
{
|
||||
let len = decoder.read_usize()?;
|
||||
Ok(decoder.tcx()
|
||||
|
@ -254,10 +244,9 @@ pub fn decode_existential_predicate_slice<'a, 'tcx, D>(decoder: &mut D)
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn decode_canonical_var_infos<'a, 'tcx, D>(decoder: &mut D)
|
||||
pub fn decode_canonical_var_infos<D>(decoder: &mut D)
|
||||
-> Result<CanonicalVarInfos<'tcx>, D::Error>
|
||||
where D: TyDecoder<'tcx>,
|
||||
'tcx: 'a,
|
||||
{
|
||||
let len = decoder.read_usize()?;
|
||||
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)
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn decode_const<'a, 'tcx, D>(decoder: &mut D)
|
||||
pub fn decode_const<D>(decoder: &mut D)
|
||||
-> Result<&'tcx ty::Const<'tcx>, D::Error>
|
||||
where D: TyDecoder<'tcx>,
|
||||
'tcx: 'a,
|
||||
{
|
||||
Ok(decoder.tcx().mk_const(Decodable::decode(decoder)?))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn decode_allocation<'a, 'tcx, D>(decoder: &mut D)
|
||||
pub fn decode_allocation<D>(decoder: &mut D)
|
||||
-> Result<&'tcx Allocation, D::Error>
|
||||
where D: TyDecoder<'tcx>,
|
||||
'tcx: 'a,
|
||||
{
|
||||
Ok(decoder.tcx().intern_const_alloc(Decodable::decode(decoder)?))
|
||||
}
|
||||
|
|
|
@ -1727,7 +1727,7 @@ impl<'tcx> SizeSkeleton<'tcx> {
|
|||
}
|
||||
|
||||
pub trait HasTyCtxt<'tcx>: HasDataLayout {
|
||||
fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx>;
|
||||
fn tcx(&self) -> TyCtxt<'tcx, 'tcx>;
|
||||
}
|
||||
|
||||
pub trait HasParamEnv<'tcx> {
|
||||
|
@ -1741,7 +1741,7 @@ impl<'gcx, 'tcx> HasDataLayout for TyCtxt<'gcx, 'tcx> {
|
|||
}
|
||||
|
||||
impl<'gcx, 'tcx> HasTyCtxt<'gcx> for TyCtxt<'gcx, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'gcx> {
|
||||
fn tcx(&self) -> TyCtxt<'gcx, 'gcx> {
|
||||
self.global_tcx()
|
||||
}
|
||||
}
|
||||
|
@ -1759,7 +1759,7 @@ impl<'tcx, T: HasDataLayout> HasDataLayout for LayoutCx<'tcx, T> {
|
|||
}
|
||||
|
||||
impl<'gcx, 'tcx, T: HasTyCtxt<'gcx>> HasTyCtxt<'gcx> for LayoutCx<'tcx, T> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'gcx> {
|
||||
fn tcx(&self) -> TyCtxt<'gcx, 'gcx> {
|
||||
self.tcx.tcx()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ impl ty::layout::HasDataLayout for Builder<'_, '_, '_> {
|
|||
}
|
||||
|
||||
impl ty::layout::HasTyCtxt<'tcx> for Builder<'_, '_, 'tcx> {
|
||||
fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'tcx, 'tcx> {
|
||||
self.cx.tcx
|
||||
}
|
||||
}
|
||||
|
|
|
@ -838,7 +838,7 @@ impl HasTargetSpec for CodegenCx<'ll, 'tcx> {
|
|||
}
|
||||
|
||||
impl ty::layout::HasTyCtxt<'tcx> for CodegenCx<'ll, 'tcx> {
|
||||
fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'tcx, 'tcx> {
|
||||
self.tcx
|
||||
}
|
||||
}
|
||||
|
|
|
@ -203,7 +203,7 @@ impl Printer<'tcx, 'tcx> for SymbolPrinter<'tcx> {
|
|||
type DynExistential = Self;
|
||||
type Const = Self;
|
||||
|
||||
fn tcx(&'a self) -> TyCtxt<'tcx, 'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'tcx, 'tcx> {
|
||||
self.tcx
|
||||
}
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ impl Printer<'tcx, 'tcx> for SymbolMangler<'tcx> {
|
|||
type DynExistential = Self;
|
||||
type Const = Self;
|
||||
|
||||
fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'tcx, 'tcx> {
|
||||
self.tcx
|
||||
}
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ impl<'mir, 'tcx, M> layout::HasTyCtxt<'tcx> for InterpretCx<'mir, 'tcx, M>
|
|||
where M: Machine<'mir, 'tcx>
|
||||
{
|
||||
#[inline]
|
||||
fn tcx<'d>(&'d self) -> TyCtxt<'tcx, 'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'tcx, 'tcx> {
|
||||
*self.tcx
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ impl<'tcx> Printer<'tcx, 'tcx> for AbsolutePathPrinter<'tcx> {
|
|||
type DynExistential = Self;
|
||||
type Const = Self;
|
||||
|
||||
fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'tcx, 'tcx> {
|
||||
self.tcx
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ impl<'mir, 'tcx> HasDataLayout for ConstPropagator<'mir, 'tcx> {
|
|||
|
||||
impl<'mir, 'tcx> HasTyCtxt<'tcx> for ConstPropagator<'mir, 'tcx> {
|
||||
#[inline]
|
||||
fn tcx<'c>(&'c self) -> TyCtxt<'tcx, 'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'tcx, 'tcx> {
|
||||
self.tcx
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ impl LayoutOf for UnwrapLayoutCx<'tcx> {
|
|||
}
|
||||
|
||||
impl HasTyCtxt<'tcx> for UnwrapLayoutCx<'tcx> {
|
||||
fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'tcx, 'tcx> {
|
||||
self.tcx
|
||||
}
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@ impl ItemCtxt<'tcx> {
|
|||
}
|
||||
|
||||
impl AstConv<'tcx, 'tcx> for ItemCtxt<'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'tcx, 'tcx> {
|
||||
self.tcx
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue