Skip to content

Commit c891d80

Browse files
committed
move ValueIndex up a level
1 parent 39cd395 commit c891d80

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

chalk-rust/src/solve/infer/mod.rs

+16
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,22 @@ pub type ParameterInferenceVariable = ParameterKind<TyInferenceVariable,
4040
LifetimeInferenceVariable,
4141
KrateInferenceVariable>;
4242

43+
/// An index into the `InferenceTable.values` vector.
44+
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
45+
pub struct ValueIndex {
46+
index: u32
47+
}
48+
49+
impl ValueIndex {
50+
pub fn new(value: usize) -> ValueIndex {
51+
ValueIndex { index: value as u32 }
52+
}
53+
54+
pub fn as_usize(&self) -> usize {
55+
self.index as usize
56+
}
57+
}
58+
4359
impl InferenceTable {
4460
pub fn new() -> Self {
4561
InferenceTable {

chalk-rust/src/solve/infer/ty_var.rs

-16
Original file line numberDiff line numberDiff line change
@@ -72,22 +72,6 @@ impl UnifyValue for TyInferenceValue {
7272
}
7373
}
7474

75-
/// An index into the `InferenceTable.values` vector.
76-
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
77-
pub struct ValueIndex {
78-
index: u32
79-
}
80-
81-
impl ValueIndex {
82-
pub fn new(value: usize) -> ValueIndex {
83-
ValueIndex { index: value as u32 }
84-
}
85-
86-
pub fn as_usize(&self) -> usize {
87-
self.index as usize
88-
}
89-
}
90-
9175
impl fmt::Debug for TyInferenceVariable {
9276
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
9377
write!(fmt, "?{}", self.index)

0 commit comments

Comments
 (0)