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
|
@ -1266,15 +1266,6 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
self.resolve_vars_if_possible(t).to_string()
|
||||
}
|
||||
|
||||
pub fn tys_to_string(&self, ts: &[Ty<'tcx>]) -> String {
|
||||
let tstrs: Vec<String> = ts.iter().map(|t| self.ty_to_string(*t)).collect();
|
||||
format!("({})", tstrs.join(", "))
|
||||
}
|
||||
|
||||
pub fn trait_ref_to_string(&self, t: ty::TraitRef<'tcx>) -> String {
|
||||
self.resolve_vars_if_possible(t).print_only_trait_path().to_string()
|
||||
}
|
||||
|
||||
/// If `TyVar(vid)` resolves to a type, return that type. Else, return the
|
||||
/// universe index of `TyVar(vid)`.
|
||||
pub fn probe_ty_var(&self, vid: TyVid) -> Result<Ty<'tcx>, ty::UniverseIndex> {
|
||||
|
@ -1704,14 +1695,6 @@ impl<'tcx> TypeTrace<'tcx> {
|
|||
) -> TypeTrace<'tcx> {
|
||||
TypeTrace { cause: cause.clone(), values: Consts(ExpectedFound::new(a_is_expected, a, b)) }
|
||||
}
|
||||
|
||||
pub fn dummy(tcx: TyCtxt<'tcx>) -> TypeTrace<'tcx> {
|
||||
let err = tcx.ty_error();
|
||||
TypeTrace {
|
||||
cause: ObligationCause::dummy(),
|
||||
values: Types(ExpectedFound { expected: err, found: err }),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> SubregionOrigin<'tcx> {
|
||||
|
|
|
@ -92,11 +92,6 @@ impl<'a, 'tcx> OutlivesEnvironment<'tcx> {
|
|||
&self.region_bound_pairs_map
|
||||
}
|
||||
|
||||
/// Returns ownership of the `free_region_map`.
|
||||
pub fn into_free_region_map(self) -> FreeRegionMap<'tcx> {
|
||||
self.free_region_map
|
||||
}
|
||||
|
||||
/// This is a hack to support the old-skool regionck, which
|
||||
/// processes region constraints from the main function and the
|
||||
/// closure together. In that context, when we enter a closure, we
|
||||
|
|
|
@ -186,28 +186,6 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Processes a single ad-hoc region obligation that was not
|
||||
/// registered in advance.
|
||||
pub fn type_must_outlive(
|
||||
&self,
|
||||
region_bound_pairs: &RegionBoundPairs<'tcx>,
|
||||
implicit_region_bound: Option<ty::Region<'tcx>>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
origin: infer::SubregionOrigin<'tcx>,
|
||||
ty: Ty<'tcx>,
|
||||
region: ty::Region<'tcx>,
|
||||
) {
|
||||
let outlives = &mut TypeOutlives::new(
|
||||
self,
|
||||
self.tcx,
|
||||
region_bound_pairs,
|
||||
implicit_region_bound,
|
||||
param_env,
|
||||
);
|
||||
let ty = self.resolve_vars_if_possible(ty);
|
||||
outlives.type_must_outlive(origin, ty, region);
|
||||
}
|
||||
}
|
||||
|
||||
/// The `TypeOutlives` struct has the job of "lowering" a `T: 'a`
|
||||
|
|
|
@ -309,31 +309,6 @@ pub struct RegionSnapshot {
|
|||
any_unifications: bool,
|
||||
}
|
||||
|
||||
/// When working with placeholder regions, we often wish to find all of
|
||||
/// the regions that are either reachable from a placeholder region, or
|
||||
/// which can reach a placeholder region, or both. We call such regions
|
||||
/// *tainted* regions. This struct allows you to decide what set of
|
||||
/// tainted regions you want.
|
||||
#[derive(Debug)]
|
||||
pub struct TaintDirections {
|
||||
incoming: bool,
|
||||
outgoing: bool,
|
||||
}
|
||||
|
||||
impl TaintDirections {
|
||||
pub fn incoming() -> Self {
|
||||
TaintDirections { incoming: true, outgoing: false }
|
||||
}
|
||||
|
||||
pub fn outgoing() -> Self {
|
||||
TaintDirections { incoming: false, outgoing: true }
|
||||
}
|
||||
|
||||
pub fn both() -> Self {
|
||||
TaintDirections { incoming: true, outgoing: true }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> RegionConstraintStorage<'tcx> {
|
||||
pub fn new() -> Self {
|
||||
Self::default()
|
||||
|
@ -472,11 +447,6 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
|
|||
self.var_infos[vid].universe
|
||||
}
|
||||
|
||||
/// Returns the origin for the given variable.
|
||||
pub fn var_origin(&self, vid: RegionVid) -> RegionVariableOrigin {
|
||||
self.var_infos[vid].origin
|
||||
}
|
||||
|
||||
fn add_constraint(&mut self, constraint: Constraint<'tcx>, origin: SubregionOrigin<'tcx>) {
|
||||
// cannot add constraints once regions are resolved
|
||||
debug!("RegionConstraintCollector: add_constraint({:?})", constraint);
|
||||
|
@ -795,16 +765,6 @@ impl<'tcx> VerifyBound<'tcx> {
|
|||
VerifyBound::AnyBound(vec![self, vb])
|
||||
}
|
||||
}
|
||||
|
||||
pub fn and(self, vb: VerifyBound<'tcx>) -> VerifyBound<'tcx> {
|
||||
if self.must_hold() && vb.must_hold() {
|
||||
self
|
||||
} else if self.cannot_hold() && vb.cannot_hold() {
|
||||
self
|
||||
} else {
|
||||
VerifyBound::AllBounds(vec![self, vb])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> RegionConstraintData<'tcx> {
|
||||
|
|
|
@ -146,9 +146,7 @@ impl<'tcx> TypeVariableValue<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) struct Instantiate {
|
||||
vid: ty::TyVid,
|
||||
}
|
||||
pub(crate) struct Instantiate {}
|
||||
|
||||
pub(crate) struct Delegate;
|
||||
|
||||
|
@ -224,7 +222,7 @@ impl<'tcx> TypeVariableTable<'_, 'tcx> {
|
|||
// Hack: we only need this so that `types_escaping_snapshot`
|
||||
// can see what has been unified; see the Delegate impl for
|
||||
// more details.
|
||||
self.undo_log.push(Instantiate { vid });
|
||||
self.undo_log.push(Instantiate {});
|
||||
}
|
||||
|
||||
/// Creates a new type variable.
|
||||
|
@ -346,56 +344,6 @@ impl<'tcx> TypeVariableTable<'_, 'tcx> {
|
|||
)
|
||||
}
|
||||
|
||||
/// Finds the set of type variables that existed *before* `s`
|
||||
/// but which have only been unified since `s` started, and
|
||||
/// return the types with which they were unified. So if we had
|
||||
/// a type variable `V0`, then we started the snapshot, then we
|
||||
/// created a type variable `V1`, unified `V0` with `T0`, and
|
||||
/// unified `V1` with `T1`, this function would return `{T0}`.
|
||||
pub fn types_escaping_snapshot(&mut self, s: &super::Snapshot<'tcx>) -> Vec<Ty<'tcx>> {
|
||||
let mut new_elem_threshold = u32::MAX;
|
||||
let mut escaping_types = Vec::new();
|
||||
let actions_since_snapshot = self.undo_log.actions_since_snapshot(s);
|
||||
debug!("actions_since_snapshot.len() = {}", actions_since_snapshot.len());
|
||||
for i in 0..actions_since_snapshot.len() {
|
||||
let actions_since_snapshot = self.undo_log.actions_since_snapshot(s);
|
||||
match actions_since_snapshot[i] {
|
||||
super::UndoLog::TypeVariables(UndoLog::Values(sv::UndoLog::NewElem(index))) => {
|
||||
// if any new variables were created during the
|
||||
// snapshot, remember the lower index (which will
|
||||
// always be the first one we see). Note that this
|
||||
// action must precede those variables being
|
||||
// specified.
|
||||
new_elem_threshold = cmp::min(new_elem_threshold, index as u32);
|
||||
debug!("NewElem({}) new_elem_threshold={}", index, new_elem_threshold);
|
||||
}
|
||||
|
||||
super::UndoLog::TypeVariables(UndoLog::Values(sv::UndoLog::Other(
|
||||
Instantiate { vid, .. },
|
||||
))) => {
|
||||
if vid.index < new_elem_threshold {
|
||||
// quick check to see if this variable was
|
||||
// created since the snapshot started or not.
|
||||
let mut eq_relations = ut::UnificationTable::with_log(
|
||||
&mut self.storage.eq_relations,
|
||||
&mut *self.undo_log,
|
||||
);
|
||||
let escaping_type = match eq_relations.probe_value(vid) {
|
||||
TypeVariableValue::Unknown { .. } => bug!(),
|
||||
TypeVariableValue::Known { value } => value,
|
||||
};
|
||||
escaping_types.push(escaping_type);
|
||||
}
|
||||
debug!("SpecifyVar({:?}) new_elem_threshold={}", vid, new_elem_threshold);
|
||||
}
|
||||
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
escaping_types
|
||||
}
|
||||
|
||||
/// Returns indices of all variables that are not yet
|
||||
/// instantiated.
|
||||
pub fn unsolved_variables(&mut self) -> Vec<ty::TyVid> {
|
||||
|
|
|
@ -165,10 +165,6 @@ impl<'tcx> InferCtxtInner<'tcx> {
|
|||
}
|
||||
|
||||
impl<'tcx> InferCtxtUndoLogs<'tcx> {
|
||||
pub fn actions_since_snapshot(&self, snapshot: &Snapshot<'tcx>) -> &[UndoLog<'tcx>] {
|
||||
&self.logs[snapshot.undo_len..]
|
||||
}
|
||||
|
||||
pub fn start_snapshot(&mut self) -> Snapshot<'tcx> {
|
||||
self.num_open_snapshots += 1;
|
||||
Snapshot { undo_len: self.logs.len(), _marker: PhantomData }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue