Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fb86d60

Browse files
committedDec 27, 2018
Auto merge of #56384 - scalexm:chalk, r=nikomatsakis
Implement the new-style trait solver Final PR of what I believe to be a minimally working implementation of the new-style trait solver. The new trait solver can be used by providing the `-Z chalk` command line flag. It is currently used everywhere in `rustc_typeck`, and for everything relying on `rustc::infer::canonical::query_response::enter_canonical_trait_query`. The trait solver is invoked in rustc by using the `evaluate_goal` canonical query. This is not optimal because each call to `evaluate_goal` creates a new `chalk_engine::Forest`, hence rustc cannot use answers to intermediate goals produced by the root goal. We'll need to change that but I guess that's ok for now. Some next steps, I think, are: * handle region constraints: region constraints are computed but are completely ignored for now, I think we may need additional support from `chalk_engine` (as a side effect, types or trait references with outlive requirements cannot be proved well-formed) * deactivate eager normalization in the presence of `-Z chalk` in order to leverage the lazy normalization strategy of the new-style trait solver * add the remaining built-in impls (only `Sized` is supported currently) * transition the compiler to using generic goals instead of predicates that still refer to named type parameters etc I added a few very simple tests to check that the new solver has the right behavior, they won't be needed anymore once it is mature enough. Additionally it shows off that we get [implied bounds](#44491) for free. r? @nikomatsakis
2 parents bc09637 + 993d213 commit fb86d60

Some content is hidden

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

48 files changed

+1311
-293
lines changed
 

‎Cargo.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
273273

274274
[[package]]
275275
name = "chalk-engine"
276-
version = "0.8.0"
276+
version = "0.9.0"
277277
source = "registry+https://github.com/rust-lang/crates.io-index"
278278
dependencies = [
279279
"chalk-macros 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2067,7 +2067,7 @@ dependencies = [
20672067
"backtrace 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
20682068
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
20692069
"byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
2070-
"chalk-engine 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
2070+
"chalk-engine 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
20712071
"flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
20722072
"fmt_macros 0.0.0",
20732073
"graphviz 0.0.0",
@@ -2640,7 +2640,7 @@ name = "rustc_traits"
26402640
version = "0.0.0"
26412641
dependencies = [
26422642
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
2643-
"chalk-engine 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
2643+
"chalk-engine 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
26442644
"graphviz 0.0.0",
26452645
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
26462646
"rustc 0.0.0",
@@ -3403,7 +3403,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
34033403
"checksum cargo_metadata 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7d8dfe3adeb30f7938e6c1dd5327f29235d8ada3e898aeb08c343005ec2915a2"
34043404
"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16"
34053405
"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4"
3406-
"checksum chalk-engine 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6749eb72e7d4355d944a99f15fbaea701b978c18c5e184a025fcde942b0c9779"
3406+
"checksum chalk-engine 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17ec698a6f053a23bfbe646d9f2fde4b02abc19125595270a99e6f44ae0bdd1a"
34073407
"checksum chalk-macros 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "295635afd6853aa9f20baeb7f0204862440c0fe994c5a253d5f479dac41d047e"
34083408
"checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878"
34093409
"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e"

‎src/librustc/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ syntax_pos = { path = "../libsyntax_pos" }
3030
backtrace = "0.3.3"
3131
parking_lot = "0.6"
3232
byteorder = { version = "1.1", features = ["i128"]}
33-
chalk-engine = { version = "0.8.0", default-features=false }
33+
chalk-engine = { version = "0.9.0", default-features=false }
3434
rustc_fs_util = { path = "../librustc_fs_util" }
3535
smallvec = { version = "0.6.7", features = ["union", "may_dangle"] }
3636

0 commit comments

Comments
 (0)
Please sign in to comment.