Skip to content

Commit 1f9c529

Browse files
authored
Merge pull request #459 from Mcat12/cleanup/reorganize-crates
Cleanup crate structure and add features for SLG/recursive solvers
2 parents 0f195ad + 849a295 commit 1f9c529

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+194
-175
lines changed

Cargo.lock

Lines changed: 12 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@ salsa = "0.10.0"
2121
serde = "1.0"
2222
serde_derive = "1.0"
2323

24-
chalk-macros = { version = "0.10.1-dev", path = "chalk-macros" }
24+
chalk-base = { version = "0.10.1-dev", path = "chalk-base" }
2525
chalk-derive = { version = "0.10.1-dev", path = "chalk-derive" }
2626
chalk-engine = { version = "0.10.1-dev", path = "chalk-engine" }
2727
chalk-ir = { version = "0.10.1-dev", path = "chalk-ir" }
28-
chalk-rust-ir = { version = "0.10.1-dev", path = "chalk-rust-ir" }
2928
chalk-solve = { version = "0.10.1-dev", path = "chalk-solve" }
3029
chalk-parse = { version = "0.10.1-dev", path = "chalk-parse" }
3130
chalk-integration = { version = "0.10.1-dev", path = "chalk-integration" }

book/src/publishing.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
**Note: this is mostly only useful for maintainers**
44

55
The following crates get published to crates.io:
6-
- `chalk-macros`
6+
- `chalk-base`
77
- `chalk-derive`
88
- `chalk-engine`
99
- `chalk-ir`
10-
- `chalk-rust-ir`
1110
- `chalk-solve`
1211

1312
The following crates get versioned without publishing:

book/src/what_is_chalk/crates.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,18 @@ role of each crate. This crate structure helps to serve Chalk's two goals:
1111
The following crates are "public facing" crates that you may use when embedding chalk into
1212
other programs:
1313

14-
* The `chalk-solve` crate, which defines the rules that translate Rust IR into logical predicates.
14+
* The `chalk-solve` crate, which defines the IR representing Rust concepts like
15+
traits and impls and the rules that translate Rust IR into logical predicates.
1516
* The `chalk-ir` crate, which defines the IR representing types and logical predicates.
16-
* The `chalk-rust-ir` crate, which defines the IR representing Rust concepts like traits and impls.
1717

1818
The following crate is an implementation detail, used internally by `chalk-solve`:
1919

2020
* The `chalk-engine` crate, which defines the actual engine that solves logical predicate. This
2121
engine is quite general and not really specific to Rust.
2222
* The `chalk-derive` crate defines custom derives for the `chalk_ir::fold::Fold` trait and other
2323
such things.
24-
* The `chalk-macros` crate defines a few miscellaneous utility macros.
24+
* The `chalk-base` crate defines some base solver types and a few miscellaneous
25+
utility macros.
2526

2627
## Crates for standalone REPL and testing
2728

@@ -30,9 +31,9 @@ harness. These crates build on the crates above. Essentially, they
3031
define a kind of "minimal embedding" of chalk.
3132

3233
* The `chalk-parser` crate can parse Rust syntax to product an AST.
33-
* The `chalk-integration` crate can take that AST and use it to drive
34-
the `chalk-solve` crate above. The AST is converted into
35-
`chalk-rust-ir` by a process called "lowering'.
34+
* The `chalk-integration` crate can take that AST and use it to drive the
35+
`chalk-solve` crate above. The AST is converted into Rust IR by a process
36+
called "lowering'.
3637
* Finally, the main `chalk` crate, along with the testing crate in the
3738
`tests` directory, define the actual entry points.
3839

book/src/what_is_chalk/walkthrough.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ impls, and struct definitions. Parsing is often the first "phase" of
4444
transformation that a program goes through in order to become a format that
4545
chalk can understand.
4646

47-
### Rust Intermediate Representation ([chalk_rust_ir])
47+
### Rust Intermediate Representation ([chalk_solve::rust_ir])
4848

4949
After getting the AST we convert it to a more convenient intermediate
50-
representation called [`chalk_rust_ir`][chalk_rust_ir]. This is sort of
50+
representation called `chalk_rust_ir`. This is sort of
5151
analogous to the [HIR] in Rust. The process of converting to IR is called
5252
*lowering*.
5353

@@ -133,12 +133,12 @@ queries is called the *solver*.
133133

134134
Chalk's functionality is broken up into the following crates:
135135
- [**chalk_engine**][chalk_engine]: Defines the core [SLG solver][slg].
136-
- [**chalk_rust_ir**][chalk_rust_ir], containing the "HIR-like" form of the AST
137136
- [**chalk_ir**][chalk_ir]: Defines chalk's internal representation of
138137
types, lifetimes, and goals.
139138
- [**chalk_solve**][chalk_solve]: Combines `chalk_ir` and `chalk_engine`,
140139
effectively, which implements logic rules converting `chalk_rust_ir` to
141140
`chalk_ir`
141+
- Contains the `rust_ir` module, which defines the "HIR-like" Rust IR
142142
- Defines the `coherence` module, which implements coherence rules
143143
- [`chalk_engine::context`][engine-context] provides the necessary hooks.
144144
- [**chalk_parse**][chalk_parse]: Defines the raw AST and a parser.
@@ -197,7 +197,7 @@ Likewise, lowering tests use the [`lowering_success!` and
197197
[chalk_ir]: https://rust-lang.github.io/chalk/chalk_ir/index.html
198198
[chalk_parse]: https://rust-lang.github.io/chalk/chalk_parse/index.html
199199
[chalk_solve]: https://rust-lang.github.io/chalk/chalk_solve/index.html
200-
[chalk_rust_ir]: https://rust-lang.github.io/chalk/chalk_rust_ir/index.html
200+
[chalk_solve::rust_ir]: https://rust-lang.github.io/chalk/chalk_solve/rust_ir/index.html
201201
[doc-chalk]: https://rust-lang.github.io/chalk/chalk/index.html
202202
[engine-context]: https://rust-lang.github.io/chalk/chalk_engine/context/index.html
203203
[chalk-program]: https://rust-lang.github.io/chalk/chalk_integration/program/struct.Program.html
@@ -211,7 +211,7 @@ Likewise, lowering tests use the [`lowering_success!` and
211211
[chalki]: https://github.com/rust-lang/chalk/blob/master/src/main.rs
212212
[clause]: https://github.com/rust-lang/chalk/blob/master/GLOSSARY.md#clause
213213
[coherence-src]: https://rust-lang.github.io/chalk/chalk_solve/coherence/index.html
214-
[ir-code]: https://rust-lang.github.io/chalk/chalk_rust_ir/
214+
[ir-code]: https://rust-lang.github.io/chalk/chalk_solve/rust_ir/
215215
[solve-wf-src]: https://rust-lang.github.io/chalk/chalk_solve/wf/index.html
216216
[solve_goal]: https://github.com/rust-lang/chalk/blob/4bce000801de31bf45c02f742a5fce335c9f035f/src/test.rs#L85
217217
[test-lowering-macros]: https://github.com/rust-lang/chalk/blob/4bce000801de31bf45c02f742a5fce335c9f035f/src/test_util.rs#L21-L54

chalk-macros/Cargo.toml renamed to chalk-base/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
2-
name = "chalk-macros"
2+
name = "chalk-base"
33
version = "0.10.1-dev"
4-
description = "Macros for Chalk"
4+
description = "Base types for Chalk logic engines"
55
license = "Apache-2.0/MIT"
66
authors = ["Rust Compiler Team", "Chalk developers"]
77
repository = "https://github.com/rust-lang/chalk"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Various macros used within Chalk.
1+
Base types used by the SLG and recursive solvers.
22

33
See [Github](https://github.com/rust-lang/chalk) for up-to-date information.

chalk-base/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#[macro_use]
2+
extern crate lazy_static;
3+
4+
#[macro_use]
5+
mod macros;
6+
pub mod results;
7+
8+
pub use macros::*;
File renamed without changes.

chalk-macros/src/lib.rs renamed to chalk-base/src/macros/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
use std::cell::RefCell;
22

3-
#[macro_use]
4-
extern crate lazy_static;
5-
6-
#[macro_use]
73
mod index;
84

95
lazy_static! {

0 commit comments

Comments
 (0)