Skip to content

Commit 5e3cea6

Browse files
committed
Make OpaqueEncoder private.
1 parent f8c6f42 commit 5e3cea6

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};
@@ -764,6 +764,23 @@ impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>> for &'tcx [Span] {
764764

765765
//- ENCODING -------------------------------------------------------------------
766766

767+
/// This trait is a hack to work around specialization bug #55243.
768+
trait OpaqueEncoder: Encoder {
769+
fn opaque(&mut self) -> &mut opaque::Encoder;
770+
fn encoder_position(&self) -> usize;
771+
}
772+
773+
impl OpaqueEncoder for opaque::Encoder {
774+
#[inline]
775+
fn opaque(&mut self) -> &mut opaque::Encoder {
776+
self
777+
}
778+
#[inline]
779+
fn encoder_position(&self) -> usize {
780+
self.position()
781+
}
782+
}
783+
767784
/// An encoder that can write the incr. comp. cache.
768785
struct CacheEncoder<'a, 'tcx, E: OpaqueEncoder> {
769786
tcx: TyCtxt<'tcx>,

0 commit comments

Comments
 (0)