Remove (lots of) dead code
Found with https://github.com/est31/warnalyzer. Dubious changes: - Is anyone else using rustc_apfloat? I feel weird completely deleting x87 support. - Maybe some of the dead code in rustc_data_structures, in case someone wants to use it in the future? - Don't change rustc_serialize I plan to scrap most of the json module in the near future (see https://github.com/rust-lang/compiler-team/issues/418) and fixing the tests needed more work than I expected. TODO: check if any of the comments on the deleted code should be kept.
This commit is contained in:
parent
785aeac521
commit
441dc3640a
74 changed files with 60 additions and 1298 deletions
|
@ -160,6 +160,8 @@ impl DefPathHash {
|
|||
}
|
||||
|
||||
/// Returns the crate-local part of the [DefPathHash].
|
||||
///
|
||||
/// Used for tests.
|
||||
#[inline]
|
||||
pub fn local_hash(&self) -> u64 {
|
||||
self.0.as_value().1
|
||||
|
|
|
@ -1176,11 +1176,7 @@ pub fn decode_syntax_context<
|
|||
Ok(new_ctxt)
|
||||
}
|
||||
|
||||
pub fn num_syntax_ctxts() -> usize {
|
||||
HygieneData::with(|data| data.syntax_context_data.len())
|
||||
}
|
||||
|
||||
pub fn for_all_ctxts_in<E, F: FnMut((u32, SyntaxContext, &SyntaxContextData)) -> Result<(), E>>(
|
||||
fn for_all_ctxts_in<E, F: FnMut((u32, SyntaxContext, &SyntaxContextData)) -> Result<(), E>>(
|
||||
ctxts: impl Iterator<Item = SyntaxContext>,
|
||||
mut f: F,
|
||||
) -> Result<(), E> {
|
||||
|
@ -1193,7 +1189,7 @@ pub fn for_all_ctxts_in<E, F: FnMut((u32, SyntaxContext, &SyntaxContextData)) ->
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn for_all_expns_in<E, F: FnMut(u32, ExpnId, &ExpnData) -> Result<(), E>>(
|
||||
fn for_all_expns_in<E, F: FnMut(u32, ExpnId, &ExpnData) -> Result<(), E>>(
|
||||
expns: impl Iterator<Item = ExpnId>,
|
||||
mut f: F,
|
||||
) -> Result<(), E> {
|
||||
|
@ -1206,16 +1202,6 @@ pub fn for_all_expns_in<E, F: FnMut(u32, ExpnId, &ExpnData) -> Result<(), E>>(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn for_all_data<E, F: FnMut((u32, SyntaxContext, &SyntaxContextData)) -> Result<(), E>>(
|
||||
mut f: F,
|
||||
) -> Result<(), E> {
|
||||
let all_data = HygieneData::with(|data| data.syntax_context_data.clone());
|
||||
for (i, data) in all_data.into_iter().enumerate() {
|
||||
f((i as u32, SyntaxContext(i as u32), &data))?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
impl<E: Encoder> Encodable<E> for ExpnId {
|
||||
default fn encode(&self, _: &mut E) -> Result<(), E::Error> {
|
||||
panic!("cannot encode `ExpnId` with `{}`", std::any::type_name::<E>());
|
||||
|
@ -1228,14 +1214,6 @@ impl<D: Decoder> Decodable<D> for ExpnId {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn for_all_expn_data<E, F: FnMut(u32, &ExpnData) -> Result<(), E>>(mut f: F) -> Result<(), E> {
|
||||
let all_data = HygieneData::with(|data| data.expn_data.clone());
|
||||
for (i, data) in all_data.into_iter().enumerate() {
|
||||
f(i as u32, &data.unwrap_or_else(|| panic!("Missing ExpnData!")))?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn raw_encode_syntax_context<E: Encoder>(
|
||||
ctxt: SyntaxContext,
|
||||
context: &HygieneEncodeContext,
|
||||
|
|
|
@ -1037,10 +1037,6 @@ pub enum ExternalSourceKind {
|
|||
}
|
||||
|
||||
impl ExternalSource {
|
||||
pub fn is_absent(&self) -> bool {
|
||||
!matches!(self, ExternalSource::Foreign { kind: ExternalSourceKind::Present(_), .. })
|
||||
}
|
||||
|
||||
pub fn get_source(&self) -> Option<&Lrc<String>> {
|
||||
match self {
|
||||
ExternalSource::Foreign { kind: ExternalSourceKind::Present(ref src), .. } => Some(src),
|
||||
|
@ -1433,9 +1429,6 @@ impl SourceFile {
|
|||
self.src.is_none()
|
||||
}
|
||||
|
||||
pub fn byte_length(&self) -> u32 {
|
||||
self.end_pos.0 - self.start_pos.0
|
||||
}
|
||||
pub fn count_lines(&self) -> usize {
|
||||
self.lines.len()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue