Skip to content

Commit d7444c1

Browse files
committed
rustc_metadata: remove Encodable requirements from LazyMeta impls.
1 parent ee42979 commit d7444c1

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

src/librustc_metadata/rmeta/decoder.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use std::mem;
3232
use std::num::NonZeroUsize;
3333
use std::u32;
3434

35-
use rustc_serialize::{Decodable, Decoder, Encodable, SpecializedDecoder, opaque};
35+
use rustc_serialize::{Decodable, Decoder, SpecializedDecoder, opaque};
3636
use syntax::attr;
3737
use syntax::ast::{self, Ident};
3838
use syntax::source_map::{self, respan, Spanned};
@@ -217,15 +217,15 @@ impl<'a, 'tcx> Metadata<'a, 'tcx> for (&'a CrateMetadata, TyCtxt<'tcx>) {
217217
}
218218
}
219219

220-
impl<'a, 'tcx, T: Encodable + Decodable> Lazy<T> {
220+
impl<'a, 'tcx, T: Decodable> Lazy<T> {
221221
fn decode<M: Metadata<'a, 'tcx>>(self, metadata: M) -> T {
222222
let mut dcx = metadata.decoder(self.position.get());
223223
dcx.lazy_state = LazyState::NodeStart(self.position);
224224
T::decode(&mut dcx).unwrap()
225225
}
226226
}
227227

228-
impl<'a: 'x, 'tcx: 'x, 'x, T: Encodable + Decodable> Lazy<[T]> {
228+
impl<'a: 'x, 'tcx: 'x, 'x, T: Decodable> Lazy<[T]> {
229229
fn decode<M: Metadata<'a, 'tcx>>(
230230
self,
231231
metadata: M,
@@ -324,13 +324,13 @@ impl<'a, 'tcx> TyDecoder<'tcx> for DecodeContext<'a, 'tcx> {
324324
}
325325
}
326326

327-
impl<'a, 'tcx, T: Encodable> SpecializedDecoder<Lazy<T>> for DecodeContext<'a, 'tcx> {
327+
impl<'a, 'tcx, T> SpecializedDecoder<Lazy<T>> for DecodeContext<'a, 'tcx> {
328328
fn specialized_decode(&mut self) -> Result<Lazy<T>, Self::Error> {
329329
self.read_lazy_with_meta(())
330330
}
331331
}
332332

333-
impl<'a, 'tcx, T: Encodable> SpecializedDecoder<Lazy<[T]>> for DecodeContext<'a, 'tcx> {
333+
impl<'a, 'tcx, T> SpecializedDecoder<Lazy<[T]>> for DecodeContext<'a, 'tcx> {
334334
fn specialized_decode(&mut self) -> Result<Lazy<[T]>, Self::Error> {
335335
let len = self.read_usize()?;
336336
if len == 0 {

src/librustc_metadata/rmeta/encoder.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,13 @@ impl<'tcx> Encoder for EncodeContext<'tcx> {
122122
}
123123
}
124124

125-
impl<'tcx, T: Encodable> SpecializedEncoder<Lazy<T>> for EncodeContext<'tcx> {
125+
impl<'tcx, T> SpecializedEncoder<Lazy<T>> for EncodeContext<'tcx> {
126126
fn specialized_encode(&mut self, lazy: &Lazy<T>) -> Result<(), Self::Error> {
127127
self.emit_lazy_distance(*lazy)
128128
}
129129
}
130130

131-
impl<'tcx, T: Encodable> SpecializedEncoder<Lazy<[T]>> for EncodeContext<'tcx> {
131+
impl<'tcx, T> SpecializedEncoder<Lazy<[T]>> for EncodeContext<'tcx> {
132132
fn specialized_encode(&mut self, lazy: &Lazy<[T]>) -> Result<(), Self::Error> {
133133
self.emit_usize(lazy.meta)?;
134134
if lazy.meta == 0 {

src/librustc_metadata/rmeta/mod.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use rustc_target::spec::{PanicStrategy, TargetTriple};
1515
use rustc_index::vec::IndexVec;
1616
use rustc_data_structures::svh::Svh;
1717
use rustc_data_structures::sync::MetadataRef;
18-
use rustc_serialize::Encodable;
1918
use syntax::{ast, attr};
2019
use syntax::edition::Edition;
2120
use syntax::symbol::Symbol;
@@ -59,7 +58,7 @@ trait LazyMeta {
5958
fn min_size(meta: Self::Meta) -> usize;
6059
}
6160

62-
impl<T: Encodable> LazyMeta for T {
61+
impl<T> LazyMeta for T {
6362
type Meta = ();
6463

6564
fn min_size(_: ()) -> usize {
@@ -68,7 +67,7 @@ impl<T: Encodable> LazyMeta for T {
6867
}
6968
}
7069

71-
impl<T: Encodable> LazyMeta for [T] {
70+
impl<T> LazyMeta for [T] {
7271
type Meta = usize;
7372

7473
fn min_size(len: usize) -> usize {
@@ -124,13 +123,13 @@ impl<T: ?Sized + LazyMeta> Lazy<T> {
124123
}
125124
}
126125

127-
impl<T: Encodable> Lazy<T> {
126+
impl<T> Lazy<T> {
128127
fn from_position(position: NonZeroUsize) -> Lazy<T> {
129128
Lazy::from_position_and_meta(position, ())
130129
}
131130
}
132131

133-
impl<T: Encodable> Lazy<[T]> {
132+
impl<T> Lazy<[T]> {
134133
fn empty() -> Lazy<[T]> {
135134
Lazy::from_position_and_meta(NonZeroUsize::new(1).unwrap(), 0)
136135
}

0 commit comments

Comments
 (0)