Skip to content

Commit cfc9752

Browse files
committed
Rename BlockFormatter::results as BlockFormatter::cursor.
Because it's a `ResultsCursor`, not a `Results`.
1 parent dc9ba0e commit cfc9752

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

compiler/rustc_mir_dataflow/src/framework/graphviz.rs

+25-25
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,13 @@ where
9696
// the value with `None`, move it into the results cursor, move it
9797
// back out, and return it to the refcell wrapped in `Some`.
9898
let mut fmt = BlockFormatter {
99-
results: results.take().unwrap().into_results_cursor(self.body),
99+
cursor: results.take().unwrap().into_results_cursor(self.body),
100100
style: self.style,
101101
bg: Background::Light,
102102
};
103103

104104
fmt.write_node_label(&mut label, *block).unwrap();
105-
Some(fmt.results.into_results())
105+
Some(fmt.cursor.into_results())
106106
});
107107
dot::LabelText::html(String::from_utf8(label).unwrap())
108108
}
@@ -155,7 +155,7 @@ struct BlockFormatter<'mir, 'tcx, A>
155155
where
156156
A: Analysis<'tcx>,
157157
{
158-
results: ResultsCursor<'mir, 'tcx, A>,
158+
cursor: ResultsCursor<'mir, 'tcx, A>,
159159
bg: Background,
160160
style: OutputStyle,
161161
}
@@ -219,21 +219,21 @@ where
219219

220220
// C: State at start of block
221221
self.bg = Background::Light;
222-
self.results.seek_to_block_start(block);
223-
let block_start_state = self.results.get().clone();
222+
self.cursor.seek_to_block_start(block);
223+
let block_start_state = self.cursor.get().clone();
224224
self.write_row_with_full_state(w, "", "(on start)")?;
225225

226226
// D + E: Statement and terminator transfer functions
227227
self.write_statements_and_terminator(w, block)?;
228228

229229
// F: State at end of block
230230

231-
let terminator = self.results.body()[block].terminator();
231+
let terminator = self.cursor.body()[block].terminator();
232232

233233
// Write the full dataflow state immediately after the terminator if it differs from the
234234
// state at block entry.
235-
self.results.seek_to_block_end(block);
236-
if self.results.get() != &block_start_state || A::Direction::IS_BACKWARD {
235+
self.cursor.seek_to_block_end(block);
236+
if self.cursor.get() != &block_start_state || A::Direction::IS_BACKWARD {
237237
let after_terminator_name = match terminator.kind {
238238
mir::TerminatorKind::Call { target: Some(_), .. } => "(on unwind)",
239239
_ => "(on end)",
@@ -250,8 +250,8 @@ where
250250
match terminator.kind {
251251
mir::TerminatorKind::Call { destination, .. } => {
252252
self.write_row(w, "", "(on successful return)", |this, w, fmt| {
253-
let state_on_unwind = this.results.get().clone();
254-
this.results.apply_custom_effect(|analysis, state| {
253+
let state_on_unwind = this.cursor.get().clone();
254+
this.cursor.apply_custom_effect(|analysis, state| {
255255
analysis.apply_call_return_effect(
256256
state,
257257
block,
@@ -265,18 +265,18 @@ where
265265
colspan = this.style.num_state_columns(),
266266
fmt = fmt,
267267
diff = diff_pretty(
268-
this.results.get(),
268+
this.cursor.get(),
269269
&state_on_unwind,
270-
this.results.analysis()
270+
this.cursor.analysis()
271271
),
272272
)
273273
})?;
274274
}
275275

276276
mir::TerminatorKind::Yield { resume, resume_arg, .. } => {
277277
self.write_row(w, "", "(on yield resume)", |this, w, fmt| {
278-
let state_on_coroutine_drop = this.results.get().clone();
279-
this.results.apply_custom_effect(|analysis, state| {
278+
let state_on_coroutine_drop = this.cursor.get().clone();
279+
this.cursor.apply_custom_effect(|analysis, state| {
280280
analysis.apply_call_return_effect(
281281
state,
282282
resume,
@@ -290,9 +290,9 @@ where
290290
colspan = this.style.num_state_columns(),
291291
fmt = fmt,
292292
diff = diff_pretty(
293-
this.results.get(),
293+
this.cursor.get(),
294294
&state_on_coroutine_drop,
295-
this.results.analysis()
295+
this.cursor.analysis()
296296
),
297297
)
298298
})?;
@@ -302,8 +302,8 @@ where
302302
if !targets.is_empty() =>
303303
{
304304
self.write_row(w, "", "(on successful return)", |this, w, fmt| {
305-
let state_on_unwind = this.results.get().clone();
306-
this.results.apply_custom_effect(|analysis, state| {
305+
let state_on_unwind = this.cursor.get().clone();
306+
this.cursor.apply_custom_effect(|analysis, state| {
307307
analysis.apply_call_return_effect(
308308
state,
309309
block,
@@ -317,9 +317,9 @@ where
317317
colspan = this.style.num_state_columns(),
318318
fmt = fmt,
319319
diff = diff_pretty(
320-
this.results.get(),
320+
this.cursor.get(),
321321
&state_on_unwind,
322-
this.results.analysis()
322+
this.cursor.analysis()
323323
),
324324
)
325325
})?;
@@ -407,7 +407,7 @@ where
407407
block: BasicBlock,
408408
) -> io::Result<()> {
409409
let diffs =
410-
StateDiffCollector::run(self.results.body(), block, self.results.results(), self.style);
410+
StateDiffCollector::run(self.cursor.body(), block, self.cursor.results(), self.style);
411411

412412
let mut diffs_before = diffs.before.map(|v| v.into_iter());
413413
let mut diffs_after = diffs.after.into_iter();
@@ -416,7 +416,7 @@ where
416416
if A::Direction::IS_FORWARD { it.next().unwrap() } else { it.next_back().unwrap() }
417417
};
418418

419-
for (i, statement) in self.results.body()[block].statements.iter().enumerate() {
419+
for (i, statement) in self.cursor.body()[block].statements.iter().enumerate() {
420420
let statement_str = format!("{statement:?}");
421421
let index_str = format!("{i}");
422422

@@ -438,7 +438,7 @@ where
438438
assert!(diffs_after.is_empty());
439439
assert!(diffs_before.as_ref().map_or(true, ExactSizeIterator::is_empty));
440440

441-
let terminator = self.results.body()[block].terminator();
441+
let terminator = self.cursor.body()[block].terminator();
442442
let mut terminator_str = String::new();
443443
terminator.kind.fmt_head(&mut terminator_str).unwrap();
444444

@@ -488,8 +488,8 @@ where
488488
mir: &str,
489489
) -> io::Result<()> {
490490
self.write_row(w, i, mir, |this, w, fmt| {
491-
let state = this.results.get();
492-
let analysis = this.results.analysis();
491+
let state = this.cursor.get();
492+
let analysis = this.cursor.analysis();
493493

494494
// FIXME: The full state vector can be quite long. It would be nice to split on commas
495495
// and use some text wrapping algorithm.

0 commit comments

Comments
 (0)