Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 48691ea

Browse files
committedMar 29, 2021
Auto merge of rust-lang#83185 - jyn514:remove-dead-code, r=oli-obk
Remove (lots of) dead code Builds on - [ ] rust-lang#83161 - [x] rust-lang#83230 - [x] rust-lang#83197. Found with https://github.com/est31/warnalyzer. See rust-lang#77739 for a similar change in the past. Dubious changes: - Maybe some of the dead code in rustc_data_structures should be kept, in case someone wants to use it in the future? TODO: - [ ] check if any of the comments on the deleted code should be kept. - [x] update the compiler documentation; right now it fails to build - [x] finish moving `cfg(test)` changes into rust-lang#83197 cc `@est31`
2 parents 2917eda + 526bb10 commit 48691ea

File tree

74 files changed

+81
-995
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+81
-995
lines changed
 

‎compiler/rustc_arena/src/lib.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -236,26 +236,6 @@ impl<T> TypedArena<T> {
236236
start_ptr
237237
}
238238

239-
/// Allocates a slice of objects that are copied into the `TypedArena`, returning a mutable
240-
/// reference to it. Will panic if passed a zero-sized types.
241-
///
242-
/// Panics:
243-
///
244-
/// - Zero-sized types
245-
/// - Zero-length slices
246-
#[inline]
247-
pub fn alloc_slice(&self, slice: &[T]) -> &mut [T]
248-
where
249-
T: Copy,
250-
{
251-
unsafe {
252-
let len = slice.len();
253-
let start_ptr = self.alloc_raw_slice(len);
254-
slice.as_ptr().copy_to_nonoverlapping(start_ptr, len);
255-
slice::from_raw_parts_mut(start_ptr, len)
256-
}
257-
}
258-
259239
#[inline]
260240
pub fn alloc_from_iter<I: IntoIterator<Item = T>>(&self, iter: I) -> &mut [T] {
261241
assert!(mem::size_of::<T>() != 0);

‎compiler/rustc_ast/src/ast.rs

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -762,14 +762,6 @@ pub enum Mutability {
762762
}
763763

764764
impl Mutability {
765-
/// Returns `MutMutable` only if both `self` and `other` are mutable.
766-
pub fn and(self, other: Self) -> Self {
767-
match self {
768-
Mutability::Mut => other,
769-
Mutability::Not => Mutability::Not,
770-
}
771-
}
772-
773765
pub fn invert(self) -> Self {
774766
match self {
775767
Mutability::Mut => Mutability::Not,
@@ -1722,13 +1714,6 @@ impl FloatTy {
17221714
FloatTy::F64 => sym::f64,
17231715
}
17241716
}
1725-
1726-
pub fn bit_width(self) -> u64 {
1727-
match self {
1728-
FloatTy::F32 => 32,
1729-
FloatTy::F64 => 64,
1730-
}
1731-
}
17321717
}
17331718

17341719
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
@@ -1764,29 +1749,6 @@ impl IntTy {
17641749
IntTy::I128 => sym::i128,
17651750
}
17661751
}
1767-
1768-
pub fn bit_width(&self) -> Option<u64> {
1769-
Some(match *self {
1770-
IntTy::Isize => return None,
1771-
IntTy::I8 => 8,
1772-
IntTy::I16 => 16,
1773-
IntTy::I32 => 32,
1774-
IntTy::I64 => 64,
1775-
IntTy::I128 => 128,
1776-
})
1777-
}
1778-
1779-
pub fn normalize(&self, target_width: u32) -> Self {
1780-
match self {
1781-
IntTy::Isize => match target_width {
1782-
16 => IntTy::I16,
1783-
32 => IntTy::I32,
1784-
64 => IntTy::I64,
1785-
_ => unreachable!(),
1786-
},
1787-
_ => *self,
1788-
}
1789-
}
17901752
}
17911753

17921754
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Debug)]
@@ -1822,29 +1784,6 @@ impl UintTy {
18221784
UintTy::U128 => sym::u128,
18231785
}
18241786
}
1825-
1826-
pub fn bit_width(&self) -> Option<u64> {
1827-
Some(match *self {
1828-
UintTy::Usize => return None,
1829-
UintTy::U8 => 8,
1830-
UintTy::U16 => 16,
1831-
UintTy::U32 => 32,
1832-
UintTy::U64 => 64,
1833-
UintTy::U128 => 128,
1834-
})
1835-
}
1836-
1837-
pub fn normalize(&self, target_width: u32) -> Self {
1838-
match self {
1839-
UintTy::Usize => match target_width {
1840-
16 => UintTy::U16,
1841-
32 => UintTy::U32,
1842-
64 => UintTy::U64,
1843-
_ => unreachable!(),
1844-
},
1845-
_ => *self,
1846-
}
1847-
}
18481787
}
18491788

18501789
/// A constraint on an associated type (e.g., `A = Bar` in `Foo<A = Bar>` or
@@ -2215,9 +2154,6 @@ pub struct FnDecl {
22152154
}
22162155

22172156
impl FnDecl {
2218-
pub fn get_self(&self) -> Option<ExplicitSelf> {
2219-
self.inputs.get(0).and_then(Param::to_self)
2220-
}
22212157
pub fn has_self(&self) -> bool {
22222158
self.inputs.get(0).map_or(false, Param::is_self)
22232159
}

0 commit comments

Comments
 (0)