remove empty util
module
This commit is contained in:
parent
56e7575ddd
commit
ff1aaa52ff
3 changed files with 0 additions and 39 deletions
|
@ -81,7 +81,6 @@ mod session_diagnostics;
|
||||||
mod type_check;
|
mod type_check;
|
||||||
mod universal_regions;
|
mod universal_regions;
|
||||||
mod used_muts;
|
mod used_muts;
|
||||||
mod util;
|
|
||||||
|
|
||||||
/// A public API provided for the Rust compiler consumers.
|
/// A public API provided for the Rust compiler consumers.
|
||||||
pub mod consumers;
|
pub mod consumers;
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
use rustc_middle::mir::visit::{PlaceContext, Visitor};
|
|
||||||
use rustc_middle::mir::{Body, Local, Location};
|
|
||||||
|
|
||||||
pub(crate) trait FindAssignments {
|
|
||||||
// Finds all statements that assign directly to local (i.e., X = ...)
|
|
||||||
// and returns their locations.
|
|
||||||
fn find_assignments(&self, local: Local) -> Vec<Location>;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'tcx> FindAssignments for Body<'tcx> {
|
|
||||||
fn find_assignments(&self, local: Local) -> Vec<Location> {
|
|
||||||
let mut visitor = FindLocalAssignmentVisitor { needle: local, locations: vec![] };
|
|
||||||
visitor.visit_body(self);
|
|
||||||
visitor.locations
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The Visitor walks the MIR to return the assignment statements corresponding
|
|
||||||
// to a Local.
|
|
||||||
struct FindLocalAssignmentVisitor {
|
|
||||||
needle: Local,
|
|
||||||
locations: Vec<Location>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'tcx> Visitor<'tcx> for FindLocalAssignmentVisitor {
|
|
||||||
fn visit_local(&mut self, local: Local, place_context: PlaceContext, location: Location) {
|
|
||||||
if self.needle != local {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if place_context.is_place_assignment() {
|
|
||||||
self.locations.push(location);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
mod collect_writes;
|
|
||||||
|
|
||||||
pub(crate) use collect_writes::FindAssignments;
|
|
Loading…
Add table
Add a link
Reference in a new issue