X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc%2Fty%2Fcodec.rs;h=ea5d088d540fda50b3b8056fc56fb94cb1f9aa58;hb=fff08cb04389497d254fb40948674cbbee402908;hp=a76cc3dfdec02a1686729d652d79cfc2f835b93e;hpb=ba173135becd5681baa67551cafa20ce9a3017e2;p=rust.git diff --git a/src/librustc/ty/codec.rs b/src/librustc/ty/codec.rs index a76cc3dfdec..ea5d088d540 100644 --- a/src/librustc/ty/codec.rs +++ b/src/librustc/ty/codec.rs @@ -107,9 +107,8 @@ pub fn encode_predicates<'tcx, E, C>(encoder: &mut E, Ok(()) } -pub trait TyDecoder<'a, 'tcx: 'a>: Decoder { - - fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx>; +pub trait TyDecoder<'tcx>: Decoder { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx>; fn peek_byte(&self) -> u8; @@ -132,38 +131,38 @@ fn positioned_at_shorthand(&self) -> bool { } #[inline] -pub fn decode_arena_allocable<'a, 'tcx, D, T: ArenaAllocatable + Decodable>( - decoder: &mut D +pub fn decode_arena_allocable( + decoder: &mut D, ) -> Result<&'tcx T, D::Error> - where D: TyDecoder<'a, 'tcx>, - 'tcx: 'a, +where + D: TyDecoder<'tcx>, { Ok(decoder.tcx().arena.alloc(Decodable::decode(decoder)?)) } #[inline] -pub fn decode_arena_allocable_slice<'a, 'tcx, D, T: ArenaAllocatable + Decodable>( - decoder: &mut D +pub fn decode_arena_allocable_slice( + decoder: &mut D, ) -> Result<&'tcx [T], D::Error> - where D: TyDecoder<'a, 'tcx>, - 'tcx: 'a, +where + D: TyDecoder<'tcx>, { Ok(decoder.tcx().arena.alloc_from_iter( as Decodable>::decode(decoder)?)) } #[inline] -pub fn decode_cnum<'a, 'tcx, D>(decoder: &mut D) -> Result - where D: TyDecoder<'a, 'tcx>, - 'tcx: 'a, +pub fn decode_cnum(decoder: &mut D) -> Result +where + D: TyDecoder<'tcx>, { 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, D::Error> - where D: TyDecoder<'a, 'tcx>, - 'tcx: 'a, +pub fn decode_ty(decoder: &mut D) -> Result, D::Error> +where + D: TyDecoder<'tcx>, { // Handle shorthands first, if we have an usize > 0x80. if decoder.positioned_at_shorthand() { @@ -181,10 +180,9 @@ pub fn decode_ty<'a, 'tcx, D>(decoder: &mut D) -> Result, D::Error> } #[inline] -pub fn decode_predicates<'a, 'tcx, D>(decoder: &mut D) - -> Result, D::Error> - where D: TyDecoder<'a, 'tcx>, - 'tcx: 'a, +pub fn decode_predicates(decoder: &mut D) -> Result, D::Error> +where + D: TyDecoder<'tcx>, { Ok(ty::GenericPredicates { parent: Decodable::decode(decoder)?, @@ -206,9 +204,9 @@ pub fn decode_predicates<'a, 'tcx, D>(decoder: &mut D) } #[inline] -pub fn decode_substs<'a, 'tcx, D>(decoder: &mut D) -> Result, D::Error> - where D: TyDecoder<'a, 'tcx>, - 'tcx: 'a, +pub fn decode_substs(decoder: &mut D) -> Result, D::Error> +where + D: TyDecoder<'tcx>, { let len = decoder.read_usize()?; let tcx = decoder.tcx(); @@ -216,38 +214,37 @@ pub fn decode_substs<'a, 'tcx, D>(decoder: &mut D) -> Result, D: } #[inline] -pub fn decode_region<'a, 'tcx, D>(decoder: &mut D) -> Result, D::Error> - where D: TyDecoder<'a, 'tcx>, - 'tcx: 'a, +pub fn decode_region(decoder: &mut D) -> Result, D::Error> +where + D: TyDecoder<'tcx>, { Ok(decoder.tcx().mk_region(Decodable::decode(decoder)?)) } #[inline] -pub fn decode_ty_slice<'a, 'tcx, D>(decoder: &mut D) - -> Result<&'tcx ty::List>, D::Error> - where D: TyDecoder<'a, 'tcx>, - 'tcx: 'a, +pub fn decode_ty_slice(decoder: &mut D) -> Result<&'tcx ty::List>, D::Error> +where + D: TyDecoder<'tcx>, { 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) - -> Result<&'tcx ty::AdtDef, D::Error> - where D: TyDecoder<'a, 'tcx>, - 'tcx: 'a, +pub fn decode_adt_def(decoder: &mut D) -> Result<&'tcx ty::AdtDef, D::Error> +where + D: TyDecoder<'tcx>, { 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) - -> Result<&'tcx ty::List>, D::Error> - where D: TyDecoder<'a, 'tcx>, - 'tcx: 'a, +pub fn decode_existential_predicate_slice( + decoder: &mut D, +) -> Result<&'tcx ty::List>, D::Error> +where + D: TyDecoder<'tcx>, { let len = decoder.read_usize()?; Ok(decoder.tcx() @@ -255,10 +252,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) - -> Result, D::Error> - where D: TyDecoder<'a, 'tcx>, - 'tcx: 'a, +pub fn decode_canonical_var_infos(decoder: &mut D) -> Result, D::Error> +where + D: TyDecoder<'tcx>, { let len = decoder.read_usize()?; let interned: Result, _> = (0..len).map(|_| Decodable::decode(decoder)) @@ -268,19 +264,17 @@ pub fn decode_canonical_var_infos<'a, 'tcx, D>(decoder: &mut D) } #[inline] -pub fn decode_const<'a, 'tcx, D>(decoder: &mut D) - -> Result<&'tcx ty::Const<'tcx>, D::Error> - where D: TyDecoder<'a, 'tcx>, - 'tcx: 'a, +pub fn decode_const(decoder: &mut D) -> Result<&'tcx ty::Const<'tcx>, D::Error> +where + D: TyDecoder<'tcx>, { Ok(decoder.tcx().mk_const(Decodable::decode(decoder)?)) } #[inline] -pub fn decode_allocation<'a, 'tcx, D>(decoder: &mut D) - -> Result<&'tcx Allocation, D::Error> - where D: TyDecoder<'a, 'tcx>, - 'tcx: 'a, +pub fn decode_allocation(decoder: &mut D) -> Result<&'tcx Allocation, D::Error> +where + D: TyDecoder<'tcx>, { Ok(decoder.tcx().intern_const_alloc(Decodable::decode(decoder)?)) }