Skip to content

Commit 20ecbbb

Browse files
committed
Make OpaqueEncoder private.
1 parent 3b3513a commit 20ecbbb

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

compiler/rustc_middle/src/ty/codec.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,6 @@ impl<'tcx, E: TyEncoder<'tcx>> EncodableWithShorthand<'tcx, E> for ty::Predicate
5050
}
5151
}
5252

53-
pub trait OpaqueEncoder: Encoder {
54-
fn opaque(&mut self) -> &mut rustc_serialize::opaque::Encoder;
55-
fn encoder_position(&self) -> usize;
56-
}
57-
58-
impl OpaqueEncoder for rustc_serialize::opaque::Encoder {
59-
#[inline]
60-
fn opaque(&mut self) -> &mut rustc_serialize::opaque::Encoder {
61-
self
62-
}
63-
#[inline]
64-
fn encoder_position(&self) -> usize {
65-
self.position()
66-
}
67-
}
68-
6953
pub trait TyEncoder<'tcx>: Encoder {
7054
const CLEAR_CROSS_CRATE: bool;
7155

compiler/rustc_middle/src/ty/query/on_disk_cache.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::dep_graph::{DepNodeIndex, SerializedDepNodeIndex};
22
use crate::mir::interpret::{AllocDecodingSession, AllocDecodingState};
33
use crate::mir::{self, interpret};
4-
use crate::ty::codec::{OpaqueEncoder, RefDecodable, TyDecoder, TyEncoder};
4+
use crate::ty::codec::{RefDecodable, TyDecoder, TyEncoder};
55
use crate::ty::context::TyCtxt;
66
use crate::ty::{self, Ty};
77
use rustc_data_structures::fingerprint::{Fingerprint, FingerprintDecoder, FingerprintEncoder};
@@ -937,6 +937,23 @@ impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>> for &'tcx [Span] {
937937

938938
//- ENCODING -------------------------------------------------------------------
939939

940+
/// This trait is a hack to work around specialization bug #55243.
941+
trait OpaqueEncoder: Encoder {
942+
fn opaque(&mut self) -> &mut opaque::Encoder;
943+
fn encoder_position(&self) -> usize;
944+
}
945+
946+
impl OpaqueEncoder for opaque::Encoder {
947+
#[inline]
948+
fn opaque(&mut self) -> &mut opaque::Encoder {
949+
self
950+
}
951+
#[inline]
952+
fn encoder_position(&self) -> usize {
953+
self.position()
954+
}
955+
}
956+
940957
/// An encoder that can write the incr. comp. cache.
941958
struct CacheEncoder<'a, 'tcx, E: OpaqueEncoder> {
942959
tcx: TyCtxt<'tcx>,

0 commit comments

Comments
 (0)