Skip to content

Commit d0ddce8

Browse files
authored
Rollup merge of #145103 - fee1-dead-contrib:push-plompruwywvk, r=compiler-errors
rustc_metadata: remove unused private trait impls These are impls for non-reachable traits that don't appear to be used. Please let me know if there is value in keeping some of them for now. cc `@cjgillot`
2 parents cd1e82a + dbc6f58 commit d0ddce8

File tree

3 files changed

+1
-87
lines changed

3 files changed

+1
-87
lines changed

compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -74,24 +74,6 @@ impl<'a, 'tcx, T: Copy + Decodable<DecodeContext<'a, 'tcx>>> ProcessQueryValue<'
7474
}
7575
}
7676

77-
impl<'a, 'tcx, T: Copy + Decodable<DecodeContext<'a, 'tcx>>>
78-
ProcessQueryValue<'tcx, ty::EarlyBinder<'tcx, &'tcx [T]>>
79-
for Option<DecodeIterator<'a, 'tcx, T>>
80-
{
81-
#[inline(always)]
82-
fn process_decoded(
83-
self,
84-
tcx: TyCtxt<'tcx>,
85-
err: impl Fn() -> !,
86-
) -> ty::EarlyBinder<'tcx, &'tcx [T]> {
87-
ty::EarlyBinder::bind(if let Some(iter) = self {
88-
tcx.arena.alloc_from_iter(iter)
89-
} else {
90-
err()
91-
})
92-
}
93-
}
94-
9577
impl<'a, 'tcx, T: Copy + Decodable<DecodeContext<'a, 'tcx>>>
9678
ProcessQueryValue<'tcx, Option<&'tcx [T]>> for Option<DecodeIterator<'a, 'tcx, T>>
9779
{

compiler/rustc_metadata/src/rmeta/parameterized.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rustc_index::{Idx, IndexVec};
66
use rustc_middle::ty::{Binder, EarlyBinder};
77
use rustc_span::Symbol;
88

9-
use crate::rmeta::{LazyArray, LazyTable, LazyValue};
9+
use crate::rmeta::{LazyArray, LazyValue};
1010

1111
pub(crate) trait ParameterizedOverTcx: 'static {
1212
type Value<'tcx>;
@@ -48,10 +48,6 @@ impl<T: ParameterizedOverTcx> ParameterizedOverTcx for LazyArray<T> {
4848
type Value<'tcx> = LazyArray<T::Value<'tcx>>;
4949
}
5050

51-
impl<I: 'static, T: ParameterizedOverTcx> ParameterizedOverTcx for LazyTable<I, T> {
52-
type Value<'tcx> = LazyTable<I, T::Value<'tcx>>;
53-
}
54-
5551
macro_rules! trivially_parameterized_over_tcx {
5652
($($ty:ty),+ $(,)?) => {
5753
$(
@@ -154,7 +150,6 @@ parameterized_over_tcx! {
154150
rustc_middle::mir::CoroutineLayout,
155151
rustc_middle::mir::interpret::ConstAllocation,
156152
rustc_middle::ty::Clause,
157-
rustc_middle::ty::ClauseKind,
158153
rustc_middle::ty::Const,
159154
rustc_middle::ty::ConstConditions,
160155
rustc_middle::ty::FnSig,

compiler/rustc_metadata/src/rmeta/table.rs

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,6 @@ pub(super) trait FixedSizeEncoding: IsDefault {
6666
fn write_to_bytes(self, b: &mut Self::ByteArray);
6767
}
6868

69-
/// This implementation is not used generically, but for reading/writing
70-
/// concrete `u32` fields in `Lazy*` structures, which may be zero.
71-
impl FixedSizeEncoding for u32 {
72-
type ByteArray = [u8; 4];
73-
74-
#[inline]
75-
fn from_bytes(b: &[u8; 4]) -> Self {
76-
Self::from_le_bytes(*b)
77-
}
78-
79-
#[inline]
80-
fn write_to_bytes(self, b: &mut [u8; 4]) {
81-
*b = self.to_le_bytes();
82-
}
83-
}
84-
8569
impl FixedSizeEncoding for u64 {
8670
type ByteArray = [u8; 8];
8771

@@ -174,14 +158,6 @@ fixed_size_enum! {
174158
}
175159
}
176160

177-
fixed_size_enum! {
178-
ty::ImplPolarity {
179-
( Positive )
180-
( Negative )
181-
( Reservation )
182-
}
183-
}
184-
185161
fixed_size_enum! {
186162
hir::Constness {
187163
( NotConst )
@@ -306,45 +282,6 @@ impl FixedSizeEncoding for bool {
306282
}
307283
}
308284

309-
impl FixedSizeEncoding for Option<bool> {
310-
type ByteArray = [u8; 1];
311-
312-
#[inline]
313-
fn from_bytes(b: &[u8; 1]) -> Self {
314-
match b[0] {
315-
0 => Some(false),
316-
1 => Some(true),
317-
2 => None,
318-
_ => unreachable!(),
319-
}
320-
}
321-
322-
#[inline]
323-
fn write_to_bytes(self, b: &mut [u8; 1]) {
324-
debug_assert!(!self.is_default());
325-
b[0] = match self {
326-
Some(false) => 0,
327-
Some(true) => 1,
328-
None => 2,
329-
};
330-
}
331-
}
332-
333-
impl FixedSizeEncoding for UnusedGenericParams {
334-
type ByteArray = [u8; 4];
335-
336-
#[inline]
337-
fn from_bytes(b: &[u8; 4]) -> Self {
338-
let x: u32 = u32::from_bytes(b);
339-
UnusedGenericParams::from_bits(x)
340-
}
341-
342-
#[inline]
343-
fn write_to_bytes(self, b: &mut [u8; 4]) {
344-
self.bits().write_to_bytes(b);
345-
}
346-
}
347-
348285
// NOTE(eddyb) there could be an impl for `usize`, which would enable a more
349286
// generic `LazyValue<T>` impl, but in the general case we might not need / want
350287
// to fit every `usize` in `u32`.

0 commit comments

Comments
 (0)