Skip to content

Commit 28381bd

Browse files
committed
Run Rustfix on librustc_mir
1 parent bde583a commit 28381bd

File tree

11 files changed

+36
-36
lines changed

11 files changed

+36
-36
lines changed

src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ impl<'gcx, 'tcx> UseFinder<'gcx, 'tcx> {
176176
None
177177
}
178178

179-
fn def_use(&self, location: Location, thing: &MirVisitable<'tcx>) -> (bool, bool) {
179+
fn def_use(&self, location: Location, thing: &dyn MirVisitable<'tcx>) -> (bool, bool) {
180180
let mut visitor = DefUseVisitor {
181181
defined: false,
182182
used: false,

src/librustc_mir/borrow_check/nll/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,10 @@ fn dump_annotation<'a, 'gcx, 'tcx>(
260260

261261
fn for_each_region_constraint(
262262
closure_region_requirements: &ClosureRegionRequirements,
263-
with_msg: &mut FnMut(&str) -> io::Result<()>,
263+
with_msg: &mut dyn FnMut(&str) -> io::Result<()>,
264264
) -> io::Result<()> {
265265
for req in &closure_region_requirements.outlives_requirements {
266-
let subject: &Debug = match &req.subject {
266+
let subject: &dyn Debug = match &req.subject {
267267
ClosureOutlivesSubject::Region(subject) => subject,
268268
ClosureOutlivesSubject::Ty(ty) => ty,
269269
};

src/librustc_mir/borrow_check/nll/region_infer/dump_mir.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const REGION_WIDTH: usize = 8;
2323

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

2929
for region in self.regions() {
@@ -67,7 +67,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
6767
/// inference resulted in the values that it did when debugging.
6868
fn for_each_constraint(
6969
&self,
70-
with_msg: &mut FnMut(&str) -> io::Result<()>,
70+
with_msg: &mut dyn FnMut(&str) -> io::Result<()>,
7171
) -> io::Result<()> {
7272
for region in self.definitions.indices() {
7373
let value = self.liveness_constraints.region_value_str(region);

src/librustc_mir/borrow_check/nll/region_infer/graphviz.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use super::*;
2020

2121
impl<'tcx> RegionInferenceContext<'tcx> {
2222
/// Write out the region constraint graph.
23-
pub(crate) fn dump_graphviz(&self, mut w: &mut Write) -> io::Result<()> {
23+
pub(crate) fn dump_graphviz(&self, mut w: &mut dyn Write) -> io::Result<()> {
2424
dot::render(self, &mut w)
2525
}
2626
}

src/librustc_mir/borrow_check/nll/type_check/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ fn type_check_internal<'gcx, 'tcx>(
127127
mir: &Mir<'tcx>,
128128
region_bound_pairs: &[(ty::Region<'tcx>, GenericKind<'tcx>)],
129129
implicit_region_bound: Option<ty::Region<'tcx>>,
130-
extra: &mut FnMut(&mut TypeChecker<'_, 'gcx, 'tcx>),
130+
extra: &mut dyn FnMut(&mut TypeChecker<'_, 'gcx, 'tcx>),
131131
) -> MirTypeckRegionConstraints<'tcx> {
132132
let mut checker = TypeChecker::new(
133133
infcx,
@@ -231,7 +231,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> {
231231
self.cx.infcx.tcx
232232
}
233233

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

517517
fn field_ty(
518518
&mut self,
519-
parent: &fmt::Debug,
519+
parent: &dyn fmt::Debug,
520520
base_ty: PlaceTy<'tcx>,
521521
field: Field,
522522
location: Location,
@@ -1171,7 +1171,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
11711171
fn assert_iscleanup(
11721172
&mut self,
11731173
mir: &Mir<'tcx>,
1174-
ctxt: &fmt::Debug,
1174+
ctxt: &dyn fmt::Debug,
11751175
bb: BasicBlock,
11761176
iscleanuppad: bool,
11771177
) {

src/librustc_mir/dataflow/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub(crate) struct DataflowBuilder<'a, 'tcx: 'a, BD> where BD: BitDenotation
6161
pub(crate) struct DebugFormatted(String);
6262

6363
impl DebugFormatted {
64-
pub fn new(input: &fmt::Debug) -> DebugFormatted {
64+
pub fn new(input: &dyn fmt::Debug) -> DebugFormatted {
6565
DebugFormatted(format!("{:?}", input))
6666
}
6767
}

src/librustc_mir/interpret/const_eval.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ impl Error for ConstEvalError {
168168
}
169169
}
170170

171-
fn cause(&self) -> Option<&Error> {
171+
fn cause(&self) -> Option<&dyn Error> {
172172
None
173173
}
174174
}

src/librustc_mir/transform/dump_mir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl fmt::Display for Disambiguator {
4949

5050

5151
pub fn on_mir_pass<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
52-
pass_num: &fmt::Display,
52+
pass_num: &dyn fmt::Display,
5353
pass_name: &str,
5454
source: MirSource,
5555
mir: &Mir<'tcx>,

src/librustc_mir/transform/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ pub macro run_passes($tcx:ident, $mir:ident, $def_id:ident, $suite_index:expr; $
161161
promoted
162162
};
163163
let mut index = 0;
164-
let mut run_pass = |pass: &MirPass| {
164+
let mut run_pass = |pass: &dyn MirPassPassPass| {
165165
let run_hooks = |mir: &_, index, is_after| {
166166
dump_mir::on_mir_pass($tcx, &format_args!("{:03}-{:03}", suite_index, index),
167167
&pass.name(), source, mir, is_after);

src/librustc_mir/util/liveness.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,12 +425,12 @@ pub fn write_mir_fn<'a, 'tcx>(
425425
tcx: TyCtxt<'a, 'tcx, 'tcx>,
426426
src: MirSource,
427427
mir: &Mir<'tcx>,
428-
w: &mut Write,
428+
w: &mut dyn Write,
429429
result: &LivenessResult,
430430
) -> io::Result<()> {
431431
write_mir_intro(tcx, src, mir, w)?;
432432
for block in mir.basic_blocks().indices() {
433-
let print = |w: &mut Write, prefix, result: &IndexVec<BasicBlock, LocalSet>| {
433+
let print = |w: &mut dyn Write, prefix, result: &IndexVec<BasicBlock, LocalSet>| {
434434
let live: Vec<String> = mir.local_decls
435435
.indices()
436436
.filter(|i| result[block].contains(i))

src/librustc_mir/util/pretty.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ pub enum PassWhere {
7272
/// or `typeck` and `bar` both appear in the name.
7373
pub fn dump_mir<'a, 'gcx, 'tcx, F>(
7474
tcx: TyCtxt<'a, 'gcx, 'tcx>,
75-
pass_num: Option<&Display>,
75+
pass_num: Option<&dyn Display>,
7676
pass_name: &str,
77-
disambiguator: &Display,
77+
disambiguator: &dyn Display,
7878
source: MirSource,
7979
mir: &Mir<'tcx>,
8080
extra_data: F,
8181
) where
82-
F: FnMut(PassWhere, &mut Write) -> io::Result<()>,
82+
F: FnMut(PassWhere, &mut dyn Write) -> io::Result<()>,
8383
{
8484
if !dump_enabled(tcx, pass_name, source) {
8585
return;
@@ -127,15 +127,15 @@ pub fn dump_enabled<'a, 'gcx, 'tcx>(
127127

128128
fn dump_matched_mir_node<'a, 'gcx, 'tcx, F>(
129129
tcx: TyCtxt<'a, 'gcx, 'tcx>,
130-
pass_num: Option<&Display>,
130+
pass_num: Option<&dyn Display>,
131131
pass_name: &str,
132132
node_path: &str,
133-
disambiguator: &Display,
133+
disambiguator: &dyn Display,
134134
source: MirSource,
135135
mir: &Mir<'tcx>,
136136
mut extra_data: F,
137137
) where
138-
F: FnMut(PassWhere, &mut Write) -> io::Result<()>,
138+
F: FnMut(PassWhere, &mut dyn Write) -> io::Result<()>,
139139
{
140140
let _: io::Result<()> = do catch {
141141
let mut file = create_dump_file(tcx, "mir", pass_num, pass_name, disambiguator, source)?;
@@ -169,9 +169,9 @@ fn dump_matched_mir_node<'a, 'gcx, 'tcx, F>(
169169
fn dump_path(
170170
tcx: TyCtxt<'_, '_, '_>,
171171
extension: &str,
172-
pass_num: Option<&Display>,
172+
pass_num: Option<&dyn Display>,
173173
pass_name: &str,
174-
disambiguator: &Display,
174+
disambiguator: &dyn Display,
175175
source: MirSource,
176176
) -> PathBuf {
177177
let promotion_id = match source.promoted {
@@ -217,9 +217,9 @@ fn dump_path(
217217
pub(crate) fn create_dump_file(
218218
tcx: TyCtxt<'_, '_, '_>,
219219
extension: &str,
220-
pass_num: Option<&Display>,
220+
pass_num: Option<&dyn Display>,
221221
pass_name: &str,
222-
disambiguator: &Display,
222+
disambiguator: &dyn Display,
223223
source: MirSource,
224224
) -> io::Result<fs::File> {
225225
let file_path = dump_path(tcx, extension, pass_num, pass_name, disambiguator, source);
@@ -233,7 +233,7 @@ pub(crate) fn create_dump_file(
233233
pub fn write_mir_pretty<'a, 'gcx, 'tcx>(
234234
tcx: TyCtxt<'a, 'gcx, 'tcx>,
235235
single: Option<DefId>,
236-
w: &mut Write,
236+
w: &mut dyn Write,
237237
) -> io::Result<()> {
238238
writeln!(
239239
w,
@@ -274,10 +274,10 @@ pub fn write_mir_fn<'a, 'gcx, 'tcx, F>(
274274
src: MirSource,
275275
mir: &Mir<'tcx>,
276276
extra_data: &mut F,
277-
w: &mut Write,
277+
w: &mut dyn Write,
278278
) -> io::Result<()>
279279
where
280-
F: FnMut(PassWhere, &mut Write) -> io::Result<()>,
280+
F: FnMut(PassWhere, &mut dyn Write) -> io::Result<()>,
281281
{
282282
write_mir_intro(tcx, src, mir, w)?;
283283
for block in mir.basic_blocks().indices() {
@@ -298,10 +298,10 @@ pub fn write_basic_block<'cx, 'gcx, 'tcx, F>(
298298
block: BasicBlock,
299299
mir: &Mir<'tcx>,
300300
extra_data: &mut F,
301-
w: &mut Write,
301+
w: &mut dyn Write,
302302
) -> io::Result<()>
303303
where
304-
F: FnMut(PassWhere, &mut Write) -> io::Result<()>,
304+
F: FnMut(PassWhere, &mut dyn Write) -> io::Result<()>,
305305
{
306306
let data = &mir[block];
307307

@@ -362,7 +362,7 @@ where
362362
/// a statement.
363363
fn write_extra<'cx, 'gcx, 'tcx, F>(
364364
tcx: TyCtxt<'cx, 'gcx, 'tcx>,
365-
write: &mut Write,
365+
write: &mut dyn Write,
366366
mut visit_op: F,
367367
) -> io::Result<()>
368368
where
@@ -450,7 +450,7 @@ fn write_scope_tree(
450450
tcx: TyCtxt,
451451
mir: &Mir,
452452
scope_tree: &FxHashMap<VisibilityScope, Vec<VisibilityScope>>,
453-
w: &mut Write,
453+
w: &mut dyn Write,
454454
parent: VisibilityScope,
455455
depth: usize,
456456
) -> io::Result<()> {
@@ -515,7 +515,7 @@ pub fn write_mir_intro<'a, 'gcx, 'tcx>(
515515
tcx: TyCtxt<'a, 'gcx, 'tcx>,
516516
src: MirSource,
517517
mir: &Mir,
518-
w: &mut Write,
518+
w: &mut dyn Write,
519519
) -> io::Result<()> {
520520
write_mir_sig(tcx, src, mir, w)?;
521521
writeln!(w, "{{")?;
@@ -553,7 +553,7 @@ pub fn write_mir_intro<'a, 'gcx, 'tcx>(
553553
Ok(())
554554
}
555555

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

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

0 commit comments

Comments
 (0)