Auto merge of #83185 - jyn514:remove-dead-code, r=oli-obk

Remove (lots of) dead code

Builds on
- [ ] https://github.com/rust-lang/rust/pull/83161
- [x] https://github.com/rust-lang/rust/pull/83230
- [x] https://github.com/rust-lang/rust/pull/83197.

Found with https://github.com/est31/warnalyzer.
See https://github.com/rust-lang/rust/pull/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 https://github.com/rust-lang/rust/pull/83197

cc `@est31`
This commit is contained in:
bors
2021-03-29 19:44:27 +00:00
74 changed files with 81 additions and 995 deletions

View File

@@ -64,10 +64,6 @@ where
}
}
pub fn body(&self) -> &'mir mir::Body<'tcx> {
self.body
}
/// Returns the underlying `Results`.
pub fn results(&self) -> &Results<'tcx, A> {
&self.results.borrow()

View File

@@ -232,6 +232,8 @@ impl<'mir, 'tcx, Tag, Extra> Frame<'mir, 'tcx, Tag, Extra> {
/// this frame (can happen e.g. during frame initialization, and during unwinding on
/// frames without cleanup code).
/// We basically abuse `Result` as `Either`.
///
/// Used by priroda.
pub fn current_loc(&self) -> Result<mir::Location, Span> {
self.loc
}
@@ -459,11 +461,6 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
ty.size.truncate(value)
}
#[inline]
pub fn type_is_sized(&self, ty: Ty<'tcx>) -> bool {
ty.is_sized(self.tcx, self.param_env)
}
#[inline]
pub fn type_is_freeze(&self, ty: Ty<'tcx>) -> bool {
ty.is_freeze(self.tcx, self.param_env)

View File

@@ -77,14 +77,6 @@ impl<'tcx, Tag> Immediate<Tag> {
pub fn to_scalar(self) -> InterpResult<'tcx, Scalar<Tag>> {
self.to_scalar_or_uninit().check_init()
}
#[inline]
pub fn to_scalar_pair(self) -> InterpResult<'tcx, (Scalar<Tag>, Scalar<Tag>)> {
match self {
Immediate::Scalar(..) => bug!("Got a thin pointer where a scalar pair was expected"),
Immediate::ScalarPair(a, b) => Ok((a.check_init()?, b.check_init()?)),
}
}
}
// ScalarPair needs a type to interpret, so we often have an immediate and a type together

View File

@@ -40,22 +40,6 @@ impl<
}
}
pub fn new_subgraph(
graph: &'a G,
graphviz_name: &str,
node_content_fn: NodeContentFn,
edge_labels_fn: EdgeLabelsFn,
) -> Self {
Self {
graph,
is_subgraph: true,
graphviz_name: graphviz_name.to_owned(),
graph_label: None,
node_content_fn,
edge_labels_fn,
}
}
pub fn set_graph_label(&mut self, graph_label: &str) {
self.graph_label = Some(graph_label.to_owned());
}

View File

@@ -13,7 +13,6 @@ pub struct MirPatch<'tcx> {
new_locals: Vec<LocalDecl<'tcx>>,
resume_block: BasicBlock,
next_local: usize,
make_nop: Vec<Location>,
}
impl<'tcx> MirPatch<'tcx> {
@@ -25,7 +24,6 @@ impl<'tcx> MirPatch<'tcx> {
new_locals: vec![],
next_local: body.local_decls.len(),
resume_block: START_BLOCK,
make_nop: vec![],
};
// make sure the MIR we create has a resume block. It is
@@ -117,15 +115,7 @@ impl<'tcx> MirPatch<'tcx> {
self.add_statement(loc, StatementKind::Assign(box (place, rv)));
}
pub fn make_nop(&mut self, loc: Location) {
self.make_nop.push(loc);
}
pub fn apply(self, body: &mut Body<'tcx>) {
debug!("MirPatch: make nops at: {:?}", self.make_nop);
for loc in self.make_nop {
body.make_statement_nop(loc);
}
debug!(
"MirPatch: {:?} new temps, starting from index {}: {:?}",
self.new_locals.len(),