Skip to content

Commit fba241f

Browse files
author
Markus Westerlind
committed
refactor: simplify
1 parent 729d16f commit fba241f

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

src/librustc_infer/infer/fudge.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ where
2424

2525
fn const_vars_since_snapshot<'tcx>(
2626
table: &mut UnificationTable<'_, 'tcx, ConstVid<'tcx>>,
27-
snapshot: usize,
27+
snapshot_var_len: usize,
2828
) -> (Range<ConstVid<'tcx>>, Vec<ConstVariableOrigin>) {
29-
let range = vars_since_snapshot(table, snapshot);
29+
let range = vars_since_snapshot(table, snapshot_var_len);
3030
(
3131
range.start..range.end,
3232
(range.start.index..range.end.index)
@@ -98,18 +98,18 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
9898
inner.type_variables().vars_since_snapshot(&snapshot.type_snapshot);
9999
let int_vars = vars_since_snapshot(
100100
&mut inner.int_unification_table(),
101-
snapshot.int_snapshot,
101+
snapshot.int_var_len,
102102
);
103103
let float_vars = vars_since_snapshot(
104104
&mut inner.float_unification_table(),
105-
snapshot.float_snapshot,
105+
snapshot.float_var_len,
106106
);
107107
let region_vars = inner
108108
.unwrap_region_constraints()
109109
.vars_since_snapshot(&snapshot.region_constraints_snapshot);
110110
let const_vars = const_vars_since_snapshot(
111111
&mut inner.const_unification_table(),
112-
snapshot.const_snapshot,
112+
snapshot.const_var_len,
113113
);
114114

115115
let fudger = InferenceFudger {

src/librustc_infer/infer/mod.rs

+9-10
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ use rustc_span::Span;
3939
use std::cell::{Cell, Ref, RefCell};
4040
use std::collections::BTreeMap;
4141
use std::fmt;
42-
use std::marker::PhantomData;
4342

4443
use self::combine::CombineFields;
4544
use self::free_regions::RegionRelations;
@@ -241,7 +240,7 @@ impl<'tcx> InferCtxtInner<'tcx> {
241240
&mut InferCtxtUndoLogs<'tcx>,
242241
>,
243242
> {
244-
ut::UnificationTable::with_log(&mut self.int_unification_table, &mut self.undo_log)
243+
self.int_unification_table.with_log(&mut self.undo_log)
245244
}
246245

247246
fn float_unification_table(
@@ -253,7 +252,7 @@ impl<'tcx> InferCtxtInner<'tcx> {
253252
&mut InferCtxtUndoLogs<'tcx>,
254253
>,
255254
> {
256-
ut::UnificationTable::with_log(&mut self.float_unification_table, &mut self.undo_log)
255+
self.float_unification_table.with_log(&mut self.undo_log)
257256
}
258257

259258
fn const_unification_table(
@@ -265,7 +264,7 @@ impl<'tcx> InferCtxtInner<'tcx> {
265264
&mut InferCtxtUndoLogs<'tcx>,
266265
>,
267266
> {
268-
ut::UnificationTable::with_log(&mut self.const_unification_table, &mut self.undo_log)
267+
self.const_unification_table.with_log(&mut self.undo_log)
269268
}
270269

271270
pub fn unwrap_region_constraints(&mut self) -> RegionConstraintCollector<'tcx, '_> {
@@ -711,9 +710,9 @@ pub struct FullSnapshot<'a, 'tcx> {
711710
snapshot: CombinedSnapshot<'a, 'tcx>,
712711
region_constraints_snapshot: RegionSnapshot,
713712
type_snapshot: type_variable::Snapshot<'tcx>,
714-
const_snapshot: usize,
715-
int_snapshot: usize,
716-
float_snapshot: usize,
713+
const_var_len: usize,
714+
int_var_len: usize,
715+
float_var_len: usize,
717716
}
718717

719718
#[must_use = "once you start a snapshot, you should always consume it"]
@@ -837,9 +836,9 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
837836
FullSnapshot {
838837
snapshot,
839838
type_snapshot: inner.type_variables().snapshot(),
840-
const_snapshot: inner.const_unification_table().len(),
841-
int_snapshot: inner.int_unification_table().len(),
842-
float_snapshot: inner.float_unification_table().len(),
839+
const_var_len: inner.const_unification_table().len(),
840+
int_var_len: inner.int_unification_table().len(),
841+
float_var_len: inner.float_unification_table().len(),
843842
region_constraints_snapshot: inner.unwrap_region_constraints().start_snapshot(),
844843
}
845844
}

0 commit comments

Comments
 (0)