Skip to content

Commit

Permalink
Run Rustfix on librustc_mir
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Mar 3, 2018
1 parent fb7980d commit 8d730ed
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs
Expand Up @@ -176,7 +176,7 @@ impl<'gcx, 'tcx> UseFinder<'gcx, 'tcx> {
None
}

fn def_use(&self, location: Location, thing: &MirVisitable<'tcx>) -> (bool, bool) {
fn def_use(&self, location: Location, thing: &dyn MirVisitable<'tcx>) -> (bool, bool) {
let mut visitor = DefUseVisitor {
defined: false,
used: false,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/borrow_check/nll/mod.rs
Expand Up @@ -260,10 +260,10 @@ fn dump_annotation<'a, 'gcx, 'tcx>(

fn for_each_region_constraint(
closure_region_requirements: &ClosureRegionRequirements,
with_msg: &mut FnMut(&str) -> io::Result<()>,
with_msg: &mut dyn FnMut(&str) -> io::Result<()>,
) -> io::Result<()> {
for req in &closure_region_requirements.outlives_requirements {
let subject: &Debug = match &req.subject {
let subject: &dyn Debug = match &req.subject {
ClosureOutlivesSubject::Region(subject) => subject,
ClosureOutlivesSubject::Ty(ty) => ty,
};
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/borrow_check/nll/region_infer/dump_mir.rs
Expand Up @@ -23,7 +23,7 @@ const REGION_WIDTH: usize = 8;

impl<'tcx> RegionInferenceContext<'tcx> {
/// Write out our state into the `.mir` files.
pub(crate) fn dump_mir(&self, out: &mut Write) -> io::Result<()> {
pub(crate) fn dump_mir(&self, out: &mut dyn Write) -> io::Result<()> {
writeln!(out, "| Free Region Mapping")?;

for region in self.regions() {
Expand Down Expand Up @@ -67,7 +67,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
/// inference resulted in the values that it did when debugging.
fn for_each_constraint(
&self,
with_msg: &mut FnMut(&str) -> io::Result<()>,
with_msg: &mut dyn FnMut(&str) -> io::Result<()>,
) -> io::Result<()> {
for region in self.definitions.indices() {
let value = self.liveness_constraints.region_value_str(region);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/borrow_check/nll/region_infer/graphviz.rs
Expand Up @@ -20,7 +20,7 @@ use super::*;

impl<'tcx> RegionInferenceContext<'tcx> {
/// Write out the region constraint graph.
pub(crate) fn dump_graphviz(&self, mut w: &mut Write) -> io::Result<()> {
pub(crate) fn dump_graphviz(&self, mut w: &mut dyn Write) -> io::Result<()> {
dot::render(self, &mut w)
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_mir/borrow_check/nll/type_check/mod.rs
Expand Up @@ -127,7 +127,7 @@ fn type_check_internal<'gcx, 'tcx>(
mir: &Mir<'tcx>,
region_bound_pairs: &[(ty::Region<'tcx>, GenericKind<'tcx>)],
implicit_region_bound: Option<ty::Region<'tcx>>,
extra: &mut FnMut(&mut TypeChecker<'_, 'gcx, 'tcx>),
extra: &mut dyn FnMut(&mut TypeChecker<'_, 'gcx, 'tcx>),
) -> MirTypeckRegionConstraints<'tcx> {
let mut checker = TypeChecker::new(
infcx,
Expand Down Expand Up @@ -231,7 +231,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> {
self.cx.infcx.tcx
}

fn sanitize_type(&mut self, parent: &fmt::Debug, ty: Ty<'tcx>) -> Ty<'tcx> {
fn sanitize_type(&mut self, parent: &dyn fmt::Debug, ty: Ty<'tcx>) -> Ty<'tcx> {
if ty.has_escaping_regions() || ty.references_error() {
span_mirbug_and_err!(self, parent, "bad type {:?}", ty)
} else {
Expand Down Expand Up @@ -516,7 +516,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> {

fn field_ty(
&mut self,
parent: &fmt::Debug,
parent: &dyn fmt::Debug,
base_ty: PlaceTy<'tcx>,
field: Field,
location: Location,
Expand Down Expand Up @@ -1171,7 +1171,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
fn assert_iscleanup(
&mut self,
mir: &Mir<'tcx>,
ctxt: &fmt::Debug,
ctxt: &dyn fmt::Debug,
bb: BasicBlock,
iscleanuppad: bool,
) {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/dataflow/mod.rs
Expand Up @@ -61,7 +61,7 @@ pub(crate) struct DataflowBuilder<'a, 'tcx: 'a, BD> where BD: BitDenotation
pub(crate) struct DebugFormatted(String);

impl DebugFormatted {
pub fn new(input: &fmt::Debug) -> DebugFormatted {
pub fn new(input: &dyn fmt::Debug) -> DebugFormatted {
DebugFormatted(format!("{:?}", input))
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/interpret/const_eval.rs
Expand Up @@ -168,7 +168,7 @@ impl Error for ConstEvalError {
}
}

fn cause(&self) -> Option<&Error> {
fn cause(&self) -> Option<&dyn Error> {
None
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/transform/dump_mir.rs
Expand Up @@ -49,7 +49,7 @@ impl fmt::Display for Disambiguator {


pub fn on_mir_pass<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
pass_num: &fmt::Display,
pass_num: &dyn fmt::Display,
pass_name: &str,
source: MirSource,
mir: &Mir<'tcx>,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/transform/mod.rs
Expand Up @@ -161,7 +161,7 @@ pub macro run_passes($tcx:ident, $mir:ident, $def_id:ident, $suite_index:expr; $
promoted
};
let mut index = 0;
let mut run_pass = |pass: &MirPass| {
let mut run_pass = |pass: &dyn MirPassPassPass| {
let run_hooks = |mir: &_, index, is_after| {
dump_mir::on_mir_pass($tcx, &format_args!("{:03}-{:03}", suite_index, index),
&pass.name(), source, mir, is_after);
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/util/liveness.rs
Expand Up @@ -425,12 +425,12 @@ pub fn write_mir_fn<'a, 'tcx>(
tcx: TyCtxt<'a, 'tcx, 'tcx>,
src: MirSource,
mir: &Mir<'tcx>,
w: &mut Write,
w: &mut dyn Write,
result: &LivenessResult,
) -> io::Result<()> {
write_mir_intro(tcx, src, mir, w)?;
for block in mir.basic_blocks().indices() {
let print = |w: &mut Write, prefix, result: &IndexVec<BasicBlock, LocalSet>| {
let print = |w: &mut dyn Write, prefix, result: &IndexVec<BasicBlock, LocalSet>| {
let live: Vec<String> = mir.local_decls
.indices()
.filter(|i| result[block].contains(i))
Expand Down
40 changes: 20 additions & 20 deletions src/librustc_mir/util/pretty.rs
Expand Up @@ -72,14 +72,14 @@ pub enum PassWhere {
/// or `typeck` and `bar` both appear in the name.
pub fn dump_mir<'a, 'gcx, 'tcx, F>(
tcx: TyCtxt<'a, 'gcx, 'tcx>,
pass_num: Option<&Display>,
pass_num: Option<&dyn Display>,
pass_name: &str,
disambiguator: &Display,
disambiguator: &dyn Display,
source: MirSource,
mir: &Mir<'tcx>,
extra_data: F,
) where
F: FnMut(PassWhere, &mut Write) -> io::Result<()>,
F: FnMut(PassWhere, &mut dyn Write) -> io::Result<()>,
{
if !dump_enabled(tcx, pass_name, source) {
return;
Expand Down Expand Up @@ -127,15 +127,15 @@ pub fn dump_enabled<'a, 'gcx, 'tcx>(

fn dump_matched_mir_node<'a, 'gcx, 'tcx, F>(
tcx: TyCtxt<'a, 'gcx, 'tcx>,
pass_num: Option<&Display>,
pass_num: Option<&dyn Display>,
pass_name: &str,
node_path: &str,
disambiguator: &Display,
disambiguator: &dyn Display,
source: MirSource,
mir: &Mir<'tcx>,
mut extra_data: F,
) where
F: FnMut(PassWhere, &mut Write) -> io::Result<()>,
F: FnMut(PassWhere, &mut dyn Write) -> io::Result<()>,
{
let _: io::Result<()> = do catch {
let mut file = create_dump_file(tcx, "mir", pass_num, pass_name, disambiguator, source)?;
Expand Down Expand Up @@ -169,9 +169,9 @@ fn dump_matched_mir_node<'a, 'gcx, 'tcx, F>(
fn dump_path(
tcx: TyCtxt<'_, '_, '_>,
extension: &str,
pass_num: Option<&Display>,
pass_num: Option<&dyn Display>,
pass_name: &str,
disambiguator: &Display,
disambiguator: &dyn Display,
source: MirSource,
) -> PathBuf {
let promotion_id = match source.promoted {
Expand Down Expand Up @@ -217,9 +217,9 @@ fn dump_path(
pub(crate) fn create_dump_file(
tcx: TyCtxt<'_, '_, '_>,
extension: &str,
pass_num: Option<&Display>,
pass_num: Option<&dyn Display>,
pass_name: &str,
disambiguator: &Display,
disambiguator: &dyn Display,
source: MirSource,
) -> io::Result<fs::File> {
let file_path = dump_path(tcx, extension, pass_num, pass_name, disambiguator, source);
Expand All @@ -233,7 +233,7 @@ pub(crate) fn create_dump_file(
pub fn write_mir_pretty<'a, 'gcx, 'tcx>(
tcx: TyCtxt<'a, 'gcx, 'tcx>,
single: Option<DefId>,
w: &mut Write,
w: &mut dyn Write,
) -> io::Result<()> {
writeln!(
w,
Expand Down Expand Up @@ -274,10 +274,10 @@ pub fn write_mir_fn<'a, 'gcx, 'tcx, F>(
src: MirSource,
mir: &Mir<'tcx>,
extra_data: &mut F,
w: &mut Write,
w: &mut dyn Write,
) -> io::Result<()>
where
F: FnMut(PassWhere, &mut Write) -> io::Result<()>,
F: FnMut(PassWhere, &mut dyn Write) -> io::Result<()>,
{
write_mir_intro(tcx, src, mir, w)?;
for block in mir.basic_blocks().indices() {
Expand All @@ -298,10 +298,10 @@ pub fn write_basic_block<'cx, 'gcx, 'tcx, F>(
block: BasicBlock,
mir: &Mir<'tcx>,
extra_data: &mut F,
w: &mut Write,
w: &mut dyn Write,
) -> io::Result<()>
where
F: FnMut(PassWhere, &mut Write) -> io::Result<()>,
F: FnMut(PassWhere, &mut dyn Write) -> io::Result<()>,
{
let data = &mir[block];

Expand Down Expand Up @@ -362,7 +362,7 @@ where
/// a statement.
fn write_extra<'cx, 'gcx, 'tcx, F>(
tcx: TyCtxt<'cx, 'gcx, 'tcx>,
write: &mut Write,
write: &mut dyn Write,
mut visit_op: F,
) -> io::Result<()>
where
Expand Down Expand Up @@ -450,7 +450,7 @@ fn write_scope_tree(
tcx: TyCtxt,
mir: &Mir,
scope_tree: &FxHashMap<VisibilityScope, Vec<VisibilityScope>>,
w: &mut Write,
w: &mut dyn Write,
parent: VisibilityScope,
depth: usize,
) -> io::Result<()> {
Expand Down Expand Up @@ -515,7 +515,7 @@ pub fn write_mir_intro<'a, 'gcx, 'tcx>(
tcx: TyCtxt<'a, 'gcx, 'tcx>,
src: MirSource,
mir: &Mir,
w: &mut Write,
w: &mut dyn Write,
) -> io::Result<()> {
write_mir_sig(tcx, src, mir, w)?;
writeln!(w, "{{")?;
Expand Down Expand Up @@ -553,7 +553,7 @@ pub fn write_mir_intro<'a, 'gcx, 'tcx>(
Ok(())
}

fn write_mir_sig(tcx: TyCtxt, src: MirSource, mir: &Mir, w: &mut Write) -> io::Result<()> {
fn write_mir_sig(tcx: TyCtxt, src: MirSource, mir: &Mir, w: &mut dyn Write) -> io::Result<()> {
let id = tcx.hir.as_local_node_id(src.def_id).unwrap();
let body_owner_kind = tcx.hir.body_owner_kind(id);
match (body_owner_kind, src.promoted) {
Expand Down Expand Up @@ -597,7 +597,7 @@ fn write_mir_sig(tcx: TyCtxt, src: MirSource, mir: &Mir, w: &mut Write) -> io::R
Ok(())
}

fn write_temp_decls(mir: &Mir, w: &mut Write) -> io::Result<()> {
fn write_temp_decls(mir: &Mir, w: &mut dyn Write) -> io::Result<()> {
// Compiler-introduced temporary types.
for temp in mir.temps_iter() {
writeln!(
Expand Down

0 comments on commit 8d730ed

Please sign in to comment.