Skip to content

Commit 5b06023

Browse files
author
Ariel Ben-Yehuda
authored
Rollup merge of #46400 - michaelwoerister:vtable-encodable, r=eddyb
incr.comp.: Make traits::VTable encodable and decodable. Make vtables encodable so we can cache the `trans_fulfill_obligation` query at some point. r? @eddyb
2 parents b42e1c4 + 780f4ed commit 5b06023

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/librustc/traits/mod.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ pub type SelectionResult<'tcx, T> = Result<Option<T>, SelectionError<'tcx>>;
282282
/// ### The type parameter `N`
283283
///
284284
/// See explanation on `VtableImplData`.
285-
#[derive(Clone)]
285+
#[derive(Clone, RustcEncodable, RustcDecodable)]
286286
pub enum Vtable<'tcx, N> {
287287
/// Vtable identifying a particular impl.
288288
VtableImpl(VtableImplData<'tcx, N>),
@@ -327,14 +327,14 @@ pub enum Vtable<'tcx, N> {
327327
/// is `Obligation`, as one might expect. During trans, however, this
328328
/// is `()`, because trans only requires a shallow resolution of an
329329
/// impl, and nested obligations are satisfied later.
330-
#[derive(Clone, PartialEq, Eq)]
330+
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable)]
331331
pub struct VtableImplData<'tcx, N> {
332332
pub impl_def_id: DefId,
333333
pub substs: &'tcx Substs<'tcx>,
334334
pub nested: Vec<N>
335335
}
336336

337-
#[derive(Clone, PartialEq, Eq)]
337+
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable)]
338338
pub struct VtableGeneratorData<'tcx, N> {
339339
pub closure_def_id: DefId,
340340
pub substs: ty::ClosureSubsts<'tcx>,
@@ -343,7 +343,7 @@ pub struct VtableGeneratorData<'tcx, N> {
343343
pub nested: Vec<N>
344344
}
345345

346-
#[derive(Clone, PartialEq, Eq)]
346+
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable)]
347347
pub struct VtableClosureData<'tcx, N> {
348348
pub closure_def_id: DefId,
349349
pub substs: ty::ClosureSubsts<'tcx>,
@@ -352,20 +352,20 @@ pub struct VtableClosureData<'tcx, N> {
352352
pub nested: Vec<N>
353353
}
354354

355-
#[derive(Clone)]
355+
#[derive(Clone, RustcEncodable, RustcDecodable)]
356356
pub struct VtableAutoImplData<N> {
357357
pub trait_def_id: DefId,
358358
pub nested: Vec<N>
359359
}
360360

361-
#[derive(Clone)]
361+
#[derive(Clone, RustcEncodable, RustcDecodable)]
362362
pub struct VtableBuiltinData<N> {
363363
pub nested: Vec<N>
364364
}
365365

366366
/// A vtable for some object-safe trait `Foo` automatically derived
367367
/// for the object type `Foo`.
368-
#[derive(PartialEq,Eq,Clone)]
368+
#[derive(PartialEq, Eq, Clone, RustcEncodable, RustcDecodable)]
369369
pub struct VtableObjectData<'tcx, N> {
370370
/// `Foo` upcast to the obligation trait. This will be some supertrait of `Foo`.
371371
pub upcast_trait_ref: ty::PolyTraitRef<'tcx>,
@@ -378,7 +378,7 @@ pub struct VtableObjectData<'tcx, N> {
378378
pub nested: Vec<N>,
379379
}
380380

381-
#[derive(Clone, PartialEq, Eq)]
381+
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable)]
382382
pub struct VtableFnPointerData<'tcx, N> {
383383
pub fn_ty: Ty<'tcx>,
384384
pub nested: Vec<N>

0 commit comments

Comments
 (0)