Skip to content

Commit 9456600

Browse files
committed
Auto merge of #718 - flodiebold:visibility, r=jackh726
Make various methods on InferenceTable public I don't see a reason for them to be pub(crate), and especially the snapshot/rollback functionality is necessary for rust-analyzer. I made some other functions more private that are only used from their modules.
2 parents eb24af1 + 5442f5e commit 9456600

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

chalk-solve/src/infer.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ pub struct InferenceTable<I: Interner> {
2020
max_universe: UniverseIndex,
2121
}
2222

23-
pub(crate) struct InferenceSnapshot<I: Interner> {
23+
pub struct InferenceSnapshot<I: Interner> {
2424
unify_snapshot: ena::unify::Snapshot<ena::unify::InPlace<EnaVariable<I>>>,
2525
max_universe: UniverseIndex,
2626
vars: Vec<EnaVariable<I>>,
2727
}
2828

2929
#[allow(type_alias_bounds)]
30-
pub(crate) type ParameterEnaVariable<I: Interner> = WithKind<I, EnaVariable<I>>;
30+
pub type ParameterEnaVariable<I: Interner> = WithKind<I, EnaVariable<I>>;
3131

3232
impl<I: Interner> InferenceTable<I> {
3333
/// Create an empty inference table with no variables.
@@ -72,7 +72,7 @@ impl<I: Interner> InferenceTable<I> {
7272
/// others created within this inference table. This universe is
7373
/// able to see all previously created universes (though hopefully
7474
/// it is only brought into contact with its logical *parents*).
75-
pub(crate) fn new_universe(&mut self) -> UniverseIndex {
75+
pub fn new_universe(&mut self) -> UniverseIndex {
7676
let u = self.max_universe.next();
7777
self.max_universe = u;
7878
debug!("created new universe: {:?}", u);
@@ -95,7 +95,7 @@ impl<I: Interner> InferenceTable<I> {
9595
/// must respect a stack discipline (i.e., rollback or commit
9696
/// snapshots in reverse order of that with which they were
9797
/// created).
98-
pub(crate) fn snapshot(&mut self) -> InferenceSnapshot<I> {
98+
pub fn snapshot(&mut self) -> InferenceSnapshot<I> {
9999
let unify_snapshot = self.unify.snapshot();
100100
let vars = self.vars.clone();
101101
let max_universe = self.max_universe;
@@ -107,14 +107,14 @@ impl<I: Interner> InferenceTable<I> {
107107
}
108108

109109
/// Restore the table to the state it had when the snapshot was taken.
110-
pub(crate) fn rollback_to(&mut self, snapshot: InferenceSnapshot<I>) {
110+
pub fn rollback_to(&mut self, snapshot: InferenceSnapshot<I>) {
111111
self.unify.rollback_to(snapshot.unify_snapshot);
112112
self.vars = snapshot.vars;
113113
self.max_universe = snapshot.max_universe;
114114
}
115115

116116
/// Make permanent the changes made since the snapshot was taken.
117-
pub(crate) fn commit(&mut self, snapshot: InferenceSnapshot<I>) {
117+
pub fn commit(&mut self, snapshot: InferenceSnapshot<I>) {
118118
self.unify.commit(snapshot.unify_snapshot);
119119
}
120120

chalk-solve/src/infer/instantiate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ impl<I: Interner> InferenceTable<I> {
1111
/// inference variable. This substitution can then be applied to
1212
/// C, which would be equivalent to
1313
/// `self.instantiate_canonical(v)`.
14-
pub(crate) fn fresh_subst(
14+
pub(super) fn fresh_subst(
1515
&mut self,
1616
interner: &I,
1717
binders: &[CanonicalVarKind<I>],
@@ -39,7 +39,7 @@ impl<I: Interner> InferenceTable<I> {
3939
/// `binders`. This is used to apply a universally quantified
4040
/// clause like `forall X, 'Y. P => Q`. Here the `binders`
4141
/// argument is referring to `X, 'Y`.
42-
pub(crate) fn instantiate_in<T>(
42+
fn instantiate_in<T>(
4343
&mut self,
4444
interner: &I,
4545
universe: UniverseIndex,

0 commit comments

Comments
 (0)