Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,77 @@ dependencies = [
"rustc-std-workspace-core",
]

[[package]]
name = "chalk-derive"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d4620afad4d4d9e63f915cfa10c930b7a3c9c3ca5cd88dd771ff8e5bf04ea10"
dependencies = [
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
"synstructure 0.12.1",
]

[[package]]
name = "chalk-engine"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ca6e5cef10197789da0b4ec310eda58da4c55530613b2323432642a97372735"
dependencies = [
"chalk-macros",
"rustc-hash",
]

[[package]]
name = "chalk-ir"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d45df5fb6328527f976e8a32c9e1c9970084d937ebe93d0d34f5bbf4231cb956"
dependencies = [
"chalk-derive",
"chalk-engine",
"chalk-macros",
]

[[package]]
name = "chalk-macros"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e4782d108e420a1fcf94d8a919cf248db33c5071678e87d9c2d4f20ed1feb32"
dependencies = [
"lazy_static 1.4.0",
]

[[package]]
name = "chalk-rust-ir"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0ec96dbe0ab5fdbadfca4179ec2e1d35f0439c3b53a74988b1aec239c63eb08"
dependencies = [
"chalk-derive",
"chalk-engine",
"chalk-ir",
"chalk-macros",
]

[[package]]
name = "chalk-solve"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfb99fa9530f0e101475fb60adc931f51bdea05b4642a48928b814d7f0141a6b"
dependencies = [
"chalk-derive",
"chalk-engine",
"chalk-ir",
"chalk-macros",
"chalk-rust-ir",
"ena 0.13.1",
"itertools 0.9.0",
"petgraph",
"rustc-hash",
]

[[package]]
name = "chrono"
version = "0.4.6"
Expand Down Expand Up @@ -1102,6 +1173,12 @@ dependencies = [
"winapi 0.3.8",
]

[[package]]
name = "fixedbitset"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33"

[[package]]
name = "flate2"
version = "1.0.12"
Expand Down Expand Up @@ -2328,6 +2405,12 @@ dependencies = [
"vcpkg",
]

[[package]]
name = "ordermap"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063"

[[package]]
name = "ordslice"
version = "0.3.0"
Expand Down Expand Up @@ -2496,6 +2579,16 @@ dependencies = [
"sha-1",
]

[[package]]
name = "petgraph"
version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f"
dependencies = [
"fixedbitset",
"ordermap",
]

[[package]]
name = "phf"
version = "0.7.24"
Expand Down Expand Up @@ -4002,6 +4095,7 @@ dependencies = [
"arena",
"bitflags",
"byteorder",
"chalk-ir",
"log",
"measureme",
"polonius-engine",
Expand Down Expand Up @@ -4301,10 +4395,14 @@ dependencies = [
name = "rustc_traits"
version = "0.0.0"
dependencies = [
"chalk-ir",
"chalk-rust-ir",
"chalk-solve",
"log",
"rustc_ast",
"rustc_data_structures",
"rustc_hir",
"rustc_index",
"rustc_infer",
"rustc_middle",
"rustc_span",
Expand Down
12 changes: 8 additions & 4 deletions src/librustc_infer/infer/canonical/canonicalizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,10 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
// `TyVar(vid)` is unresolved, track its universe index in the canonicalized
// result.
Err(mut ui) => {
// FIXME: perf problem described in #55921.
ui = ty::UniverseIndex::ROOT;
if !self.infcx.unwrap().tcx.sess.opts.debugging_opts.chalk {
// FIXME: perf problem described in #55921.
ui = ty::UniverseIndex::ROOT;
}
self.canonicalize_ty_var(
CanonicalVarInfo {
kind: CanonicalVarKind::Ty(CanonicalTyVarKind::General(ui)),
Expand Down Expand Up @@ -439,8 +441,10 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
// `ConstVar(vid)` is unresolved, track its universe index in the
// canonicalized result
Err(mut ui) => {
// FIXME: perf problem described in #55921.
ui = ty::UniverseIndex::ROOT;
if !self.infcx.unwrap().tcx.sess.opts.debugging_opts.chalk {
// FIXME: perf problem described in #55921.
ui = ty::UniverseIndex::ROOT;
}
return self.canonicalize_const_var(
CanonicalVarInfo { kind: CanonicalVarKind::Const(ui) },
ct,
Expand Down
1 change: 1 addition & 0 deletions src/librustc_interface/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ fn test_debugging_options_tracking_hash() {
tracked!(always_encode_mir, true);
tracked!(asm_comments, true);
tracked!(binary_dep_depinfo, true);
tracked!(chalk, true);
tracked!(codegen_backend, Some("abc".to_string()));
tracked!(crate_attr, vec!["abc".to_string()]);
tracked!(debug_macros, true);
Expand Down
1 change: 1 addition & 0 deletions src/librustc_middle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ rustc_serialize = { path = "../libserialize", package = "serialize" }
rustc_ast = { path = "../librustc_ast" }
rustc_span = { path = "../librustc_span" }
byteorder = { version = "1.3" }
chalk-ir = "0.10.0"
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
measureme = "0.7.1"
rustc_session = { path = "../librustc_session" }
1 change: 1 addition & 0 deletions src/librustc_middle/dep_graph/dep_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@

use crate::mir;
use crate::mir::interpret::{GlobalId, LitToConstInput};
use crate::traits;
use crate::traits::query::{
CanonicalPredicateGoal, CanonicalProjectionGoal, CanonicalTyGoal,
CanonicalTypeOpAscribeUserTypeGoal, CanonicalTypeOpEqGoal, CanonicalTypeOpNormalizeGoal,
Expand Down
10 changes: 10 additions & 0 deletions src/librustc_middle/query/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::dep_graph::SerializedDepNodeIndex;
use crate::mir;
use crate::mir::interpret::{GlobalId, LitToConstInput};
use crate::traits;
use crate::traits::query::{
CanonicalPredicateGoal, CanonicalProjectionGoal, CanonicalTyGoal,
CanonicalTypeOpAscribeUserTypeGoal, CanonicalTypeOpEqGoal, CanonicalTypeOpNormalizeGoal,
Expand Down Expand Up @@ -1154,6 +1155,15 @@ rustc_queries! {
desc { "evaluating trait selection obligation `{}`", goal.value.value }
}

query evaluate_goal(
goal: traits::ChalkCanonicalGoal<'tcx>
) -> Result<
&'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ()>>,
NoSolution
> {
desc { "evaluating trait selection obligation `{}`", goal.value }
}

/// Do not call this query directly: part of the `Eq` type-op
query type_op_ascribe_user_type(
goal: CanonicalTypeOpAscribeUserTypeGoal<'tcx>
Expand Down
Loading