Skip to content

Commit 3b60751

Browse files
committed
remove crate_visibility_modifier
1 parent 9835e21 commit 3b60751

File tree

11 files changed

+75
-77
lines changed

11 files changed

+75
-77
lines changed

chalk-engine/src/context.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
use crate::fallible::Fallible;
2-
use crate::hh::HhGoal;
3-
use crate::{DelayedLiteral, ExClause, SimplifiedAnswer};
1+
use fallible::Fallible;
2+
use hh::HhGoal;
3+
use {DelayedLiteral, ExClause, SimplifiedAnswer};
44
use std::fmt::Debug;
55
use std::hash::Hash;
66

7-
crate mod prelude;
7+
pub(crate) mod prelude;
88

99
/// The "context" in which the SLG solver operates. It defines all the
1010
/// types that the SLG solver may need to refer to, as well as a few

chalk-engine/src/context/prelude.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#![allow(unused_imports)] // rustc bug
22

3-
crate use super::Context;
4-
crate use super::ContextOps;
5-
crate use super::AggregateOps;
6-
crate use super::ResolventOps;
7-
crate use super::TruncateOps;
8-
crate use super::InferenceTable;
3+
pub(crate) use super::Context;
4+
pub(crate) use super::ContextOps;
5+
pub(crate) use super::AggregateOps;
6+
pub(crate) use super::ResolventOps;
7+
pub(crate) use super::TruncateOps;
8+
pub(crate) use super::InferenceTable;

chalk-engine/src/forest.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
use crate::{DepthFirstNumber, SimplifiedAnswer, TableIndex};
2-
use crate::context::prelude::*;
3-
use crate::context::AnswerStream;
4-
use crate::logic::RootSearchFail;
5-
use crate::stack::{Stack, StackIndex};
6-
use crate::tables::Tables;
7-
use crate::table::{Answer, AnswerIndex};
1+
use {DepthFirstNumber, SimplifiedAnswer, TableIndex};
2+
use context::prelude::*;
3+
use context::AnswerStream;
4+
use logic::RootSearchFail;
5+
use stack::{Stack, StackIndex};
6+
use tables::Tables;
7+
use table::{Answer, AnswerIndex};
88

99
pub struct Forest<C: Context, CO: ContextOps<C>> {
1010
#[allow(dead_code)]
11-
crate context: CO,
12-
crate tables: Tables<C>,
13-
crate stack: Stack,
11+
pub(crate) context: CO,
12+
pub(crate) tables: Tables<C>,
13+
pub(crate) stack: Stack,
1414

1515
dfn: DepthFirstNumber,
1616
}

chalk-engine/src/hh.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::context::Context;
1+
use context::Context;
22

33
#[derive(Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
44
/// A general goal; this is the full range of questions you can pose to Chalk.

chalk-engine/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@
4949
//! - HH: Hereditary harrop predicates. What Chalk deals in.
5050
//! Popularized by Lambda Prolog.
5151
52-
#![feature(crate_in_paths)]
53-
#![feature(crate_visibility_modifier)]
5452
#![feature(in_band_lifetimes)]
5553
#![feature(step_trait)]
5654
#![feature(non_modrs_mods)]
@@ -63,7 +61,7 @@ extern crate stacker;
6361

6462
extern crate rustc_hash;
6563

66-
use crate::context::Context;
64+
use context::Context;
6765
use rustc_hash::FxHashSet;
6866
use std::cmp::min;
6967
use std::usize;

chalk-engine/src/logic.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
use crate::{DelayedLiteral, DelayedLiteralSet, DepthFirstNumber, ExClause, Literal, Minimums,
1+
use {DelayedLiteral, DelayedLiteralSet, DepthFirstNumber, ExClause, Literal, Minimums,
22
TableIndex};
3-
use crate::fallible::NoSolution;
4-
use crate::context::{WithInstantiatedExClause, WithInstantiatedUCanonicalGoal, prelude::*};
5-
use crate::forest::Forest;
6-
use crate::hh::HhGoal;
7-
use crate::stack::StackIndex;
8-
use crate::strand::{CanonicalStrand, SelectedSubgoal, Strand};
9-
use crate::table::{Answer, AnswerIndex};
3+
use fallible::NoSolution;
4+
use context::{WithInstantiatedExClause, WithInstantiatedUCanonicalGoal, prelude::*};
5+
use forest::Forest;
6+
use hh::HhGoal;
7+
use stack::StackIndex;
8+
use strand::{CanonicalStrand, SelectedSubgoal, Strand};
9+
use table::{Answer, AnswerIndex};
1010
use rustc_hash::FxHashSet;
1111
use std::marker::PhantomData;
1212
use std::mem;
@@ -184,7 +184,7 @@ impl<C: Context, CO: ContextOps<C>> Forest<C, CO> {
184184
result.map(|()| EnsureSuccess::AnswerAvailable)
185185
}
186186

187-
crate fn answer(&self, table: TableIndex, answer: AnswerIndex) -> &Answer<C> {
187+
pub(crate) fn answer(&self, table: TableIndex, answer: AnswerIndex) -> &Answer<C> {
188188
self.tables[table].answer(answer).unwrap()
189189
}
190190

@@ -692,7 +692,7 @@ impl<C: Context, CO: ContextOps<C>> Forest<C, CO> {
692692
/// In terms of the NFTD paper, creating a new table corresponds
693693
/// to the *New Subgoal* step as well as the *Program Clause
694694
/// Resolution* steps.
695-
crate fn get_or_create_table_for_ucanonical_goal(
695+
pub(crate) fn get_or_create_table_for_ucanonical_goal(
696696
&mut self,
697697
goal: C::UCanonicalGoalInEnvironment,
698698
) -> TableIndex {
@@ -1167,7 +1167,7 @@ impl<C: Context, CO: ContextOps<C>> Forest<C, CO> {
11671167
depth: StackIndex,
11681168
strand: Strand<'_, C, impl Context>,
11691169
) -> StrandResult<C, ()> {
1170-
crate::maybe_grow_stack(|| self.pursue_strand(depth, strand))
1170+
::maybe_grow_stack(|| self.pursue_strand(depth, strand))
11711171
}
11721172

11731173
/// Invoked when we have found a successful answer to the given

chalk-engine/src/simplify.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
use crate::fallible::Fallible;
2-
use crate::{ExClause, Literal};
3-
use crate::forest::Forest;
4-
use crate::hh::HhGoal;
5-
use crate::context::prelude::*;
1+
use fallible::Fallible;
2+
use {ExClause, Literal};
3+
use forest::Forest;
4+
use hh::HhGoal;
5+
use context::prelude::*;
66

77
impl<C: Context, CO: ContextOps<C>> Forest<C, CO> {
88
/// Simplifies an HH goal into a series of positive domain goals

chalk-engine/src/stack.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
use crate::{DepthFirstNumber, TableIndex};
1+
use {DepthFirstNumber, TableIndex};
22
use std::ops::{Index, IndexMut, Range};
33

44
/// See `Forest`.
55
#[derive(Default)]
6-
crate struct Stack {
6+
pub(crate) struct Stack {
77
/// Stack: as described above, stores the in-progress goals.
88
stack: Vec<StackEntry>,
99
}
@@ -13,12 +13,12 @@ crate struct Stack {
1313
/// table is completely evaluated, it may be popped from the stack,
1414
/// and hence no longer have a stack index.
1515
index_struct! {
16-
crate struct StackIndex {
16+
pub(crate) struct StackIndex {
1717
value: usize,
1818
}
1919
}
2020

21-
crate struct StackEntry {
21+
pub(crate) struct StackEntry {
2222
/// The goal G from the stack entry `A :- G` represented here.
2323
pub(super) table: TableIndex,
2424

chalk-engine/src/strand.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
use std::fmt::{Debug, Error, Formatter};
2-
use crate::{ExClause, TableIndex};
3-
use crate::context::{Context, InferenceTable};
4-
use crate::table::AnswerIndex;
2+
use {ExClause, TableIndex};
3+
use context::{Context, InferenceTable};
4+
use table::AnswerIndex;
55

66
#[derive(Debug)]
7-
crate struct CanonicalStrand<C: Context> {
7+
pub(crate) struct CanonicalStrand<C: Context> {
88
pub(super) canonical_ex_clause: C::CanonicalExClause,
99

1010
/// Index into `ex_clause.subgoals`.
11-
crate selected_subgoal: Option<SelectedSubgoal<C>>,
11+
pub(crate) selected_subgoal: Option<SelectedSubgoal<C>>,
1212
}
1313

14-
crate struct Strand<'table, C: Context + 'table, I: Context + 'table> {
15-
crate infer: &'table mut dyn InferenceTable<C, I>,
14+
pub(crate) struct Strand<'table, C: Context + 'table, I: Context + 'table> {
15+
pub(crate) infer: &'table mut dyn InferenceTable<C, I>,
1616

1717
pub(super) ex_clause: ExClause<I>,
1818

1919
/// Index into `ex_clause.subgoals`.
20-
crate selected_subgoal: Option<SelectedSubgoal<C>>,
20+
pub(crate) selected_subgoal: Option<SelectedSubgoal<C>>,
2121
}
2222

2323
#[derive(Clone, Debug)]
24-
crate struct SelectedSubgoal<C: Context> {
24+
pub(crate) struct SelectedSubgoal<C: Context> {
2525
/// The index of the subgoal in `ex_clause.subgoals`
26-
crate subgoal_index: usize,
26+
pub(crate) subgoal_index: usize,
2727

2828
/// The index of the table that we created or found for this subgoal
2929
pub(super) subgoal_table: TableIndex,
3030

3131
/// Index of the answer we should request next from the table
32-
crate answer_index: AnswerIndex,
32+
pub(crate) answer_index: AnswerIndex,
3333

3434
/// Maps the universes of the subgoal to the canonical universes
3535
/// used in the table
36-
crate universe_map: C::UniverseMap,
36+
pub(crate) universe_map: C::UniverseMap,
3737
}
3838

3939
impl<'table, C: Context, I: Context> Debug for Strand<'table, C, I> {

chalk-engine/src/table.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
use crate::{DelayedLiteralSet, DelayedLiteralSets};
2-
use crate::context::prelude::*;
3-
use crate::strand::CanonicalStrand;
1+
use {DelayedLiteralSet, DelayedLiteralSets};
2+
use context::prelude::*;
3+
use strand::CanonicalStrand;
44
use rustc_hash::FxHashMap;
55
use std::collections::VecDeque;
66
use std::collections::hash_map::Entry;
77
use std::mem;
88

9-
crate struct Table<C: Context> {
9+
pub(crate) struct Table<C: Context> {
1010
/// The goal this table is trying to solve (also the key to look
1111
/// it up).
12-
crate table_goal: C::UCanonicalGoalInEnvironment,
12+
pub(crate) table_goal: C::UCanonicalGoalInEnvironment,
1313

1414
/// A goal is coinductive if it can assume itself to be true, more
1515
/// or less. This is true for auto traits.
16-
crate coinductive_goal: bool,
16+
pub(crate) coinductive_goal: bool,
1717

1818
/// Stores the answers that we have found thus far. When we get a request
1919
/// for an answer N, we will first check this vector.
@@ -32,7 +32,7 @@ crate struct Table<C: Context> {
3232
}
3333

3434
index_struct! {
35-
crate struct AnswerIndex {
35+
pub(crate) struct AnswerIndex {
3636
value: usize,
3737
}
3838
}
@@ -43,12 +43,12 @@ index_struct! {
4343
/// a substitution
4444
#[derive(Clone, Debug)]
4545
pub struct Answer<C: Context> {
46-
crate subst: C::CanonicalConstrainedSubst,
47-
crate delayed_literals: DelayedLiteralSet<C>,
46+
pub(crate) subst: C::CanonicalConstrainedSubst,
47+
pub(crate) delayed_literals: DelayedLiteralSet<C>,
4848
}
4949

5050
impl<C: Context> Table<C> {
51-
crate fn new(table_goal: C::UCanonicalGoalInEnvironment, coinductive_goal: bool) -> Table<C> {
51+
pub(crate) fn new(table_goal: C::UCanonicalGoalInEnvironment, coinductive_goal: bool) -> Table<C> {
5252
Table {
5353
table_goal,
5454
coinductive_goal,
@@ -58,23 +58,23 @@ impl<C: Context> Table<C> {
5858
}
5959
}
6060

61-
crate fn push_strand(&mut self, strand: CanonicalStrand<C>) {
61+
pub(crate) fn push_strand(&mut self, strand: CanonicalStrand<C>) {
6262
self.strands.push_back(strand);
6363
}
6464

65-
crate fn extend_strands(&mut self, strands: impl IntoIterator<Item = CanonicalStrand<C>>) {
65+
pub(crate) fn extend_strands(&mut self, strands: impl IntoIterator<Item = CanonicalStrand<C>>) {
6666
self.strands.extend(strands);
6767
}
6868

69-
crate fn strands_mut(&mut self) -> impl Iterator<Item = &mut CanonicalStrand<C>> {
69+
pub(crate) fn strands_mut(&mut self) -> impl Iterator<Item = &mut CanonicalStrand<C>> {
7070
self.strands.iter_mut()
7171
}
7272

73-
crate fn take_strands(&mut self) -> VecDeque<CanonicalStrand<C>> {
73+
pub(crate) fn take_strands(&mut self) -> VecDeque<CanonicalStrand<C>> {
7474
mem::replace(&mut self.strands, VecDeque::new())
7575
}
7676

77-
crate fn pop_next_strand(&mut self) -> Option<CanonicalStrand<C>> {
77+
pub(crate) fn pop_next_strand(&mut self) -> Option<CanonicalStrand<C>> {
7878
self.strands.pop_front()
7979
}
8080

@@ -127,7 +127,7 @@ impl<C: Context> Table<C> {
127127
}
128128

129129
impl AnswerIndex {
130-
crate const ZERO: AnswerIndex = AnswerIndex { value: 0 };
130+
pub(crate) const ZERO: AnswerIndex = AnswerIndex { value: 0 };
131131
}
132132

133133
impl<C: Context> Answer<C> {

chalk-engine/src/tables.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
use crate::TableIndex;
2-
use crate::context::prelude::*;
3-
use crate::table::Table;
1+
use TableIndex;
2+
use context::prelude::*;
3+
use table::Table;
44
use rustc_hash::FxHashMap;
55
use std::ops::{Index, IndexMut};
66

77
/// See `Forest`.
8-
crate struct Tables<C: Context> {
8+
pub(crate) struct Tables<C: Context> {
99
/// Maps from a canonical goal to the index of its table.
1010
table_indices: FxHashMap<C::UCanonicalGoalInEnvironment, TableIndex>,
1111

@@ -15,7 +15,7 @@ crate struct Tables<C: Context> {
1515
}
1616

1717
impl<C: Context> Tables<C> {
18-
crate fn new() -> Tables<C> {
18+
pub(crate) fn new() -> Tables<C> {
1919
Tables {
2020
table_indices: FxHashMap::default(),
2121
tables: Vec::default(),

0 commit comments

Comments
 (0)