Skip to content

Update chalk to 0.19.0 #74700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
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
90 changes: 66 additions & 24 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -435,59 +435,48 @@ dependencies = [

[[package]]
name = "chalk-derive"
version = "0.14.0"
version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d463e01905d607e181de72e8608721d3269f29176c9a14ce037011316ae7131d"
checksum = "654c611946ba2629c5028cb7708687af975faf2c29d731824cb294c873df4697"
dependencies = [
"proc-macro2",
"quote",
"syn",
"synstructure",
]

[[package]]
name = "chalk-engine"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efaf428f5398d36284f79690cf988762b7c091249f50a6c11db613a46c057000"
dependencies = [
"chalk-derive",
"chalk-ir",
"rustc-hash",
"tracing",
]

[[package]]
name = "chalk-ir"
version = "0.14.0"
version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd3fdc1e9f68498ffe80f4a23b0b95f1ca6fb21d5a4c9b0c085fab3ca712bdbe"
checksum = "0a5341fbc654ca886b73b804a36aebf0e621057ccc1a68e9815b5b39b3ac9ae8"
dependencies = [
"chalk-derive",
"lazy_static",
]

[[package]]
name = "chalk-solve"
version = "0.14.0"
version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b9fd4102807b7ebe8fb034fa0f488c5656e1966d3261b558b81a08d519cdb29"
checksum = "281f82facd2538997fbe52132b1941ed213d266748215c31d15f62a8664429ad"
dependencies = [
"chalk-derive",
"chalk-engine",
"chalk-ir",
"ena",
"itertools 0.9.0",
"petgraph",
"rustc-hash",
"tracing",
"tracing-subscriber",
"tracing-tree",
]

[[package]]
name = "chrono"
version = "0.4.6"
version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878"
checksum = "c74d84029116787153e02106bf53e66828452a4b325cc8652b788b5967c0a0b6"
dependencies = [
"num-integer",
"num-traits",
Expand Down Expand Up @@ -4630,12 +4619,11 @@ version = "0.1.0"

[[package]]
name = "time"
version = "0.1.42"
version = "0.1.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438"
dependencies = [
"libc",
"redox_syscall",
"winapi 0.3.8",
]

Expand Down Expand Up @@ -4935,6 +4923,60 @@ dependencies = [
"tracing-core",
]

name = "tracing-log"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e0f8c7178e13481ff6765bd169b33e8d554c5d2bbede5e32c356194be02b9b9"
dependencies = [
"lazy_static",
"log",
"tracing-core",
]

[[package]]
name = "tracing-serde"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6ccba2f8f16e0ed268fc765d9b7ff22e965e7185d32f8f1ec8294fe17d86e79"
dependencies = [
"serde",
"tracing-core",
]

[[package]]
name = "tracing-subscriber"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4f5dd7095c2481b7b3cbed71c8de53085fb3542bc3c2b4c73cba43e8f11c7ba"
dependencies = [
"ansi_term 0.12.1",
"chrono",
"lazy_static",
"matchers",
"regex",
"serde",
"serde_json",
"sharded-slab",
"smallvec 1.4.0",
"tracing-core",
"tracing-log",
"tracing-serde",
]

[[package]]
name = "tracing-tree"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37ee7f0f53ed2093971a698db799ef56a2dfd89b32e3aeb5165f0e637a02be04"
dependencies = [
"ansi_term 0.12.1",
"atty",
"chrono",
"termcolor",
"tracing",
"tracing-subscriber",
]

[[package]]
name = "typenum"
version = "1.12.0"
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_middle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ rustc_serialize = { path = "../librustc_serialize" }
rustc_ast = { path = "../librustc_ast" }
rustc_span = { path = "../librustc_span" }
byteorder = { version = "1.3" }
chalk-ir = "0.14.0"
chalk-ir = "0.19.0"
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
measureme = "0.7.1"
rustc_session = { path = "../librustc_session" }
15 changes: 15 additions & 0 deletions src/librustc_middle/traits/chalk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
type InternedQuantifiedWhereClauses = Vec<chalk_ir::QuantifiedWhereClause<Self>>;
type InternedVariableKinds = Vec<chalk_ir::VariableKind<Self>>;
type InternedCanonicalVarKinds = Vec<chalk_ir::CanonicalVarKind<Self>>;
type InternedConstraints = Vec<chalk_ir::InEnvironment<chalk_ir::Constraint<Self>>>;
type DefId = DefId;
type InternedAdtId = &'tcx AdtDef;
type Identifier = ();
Expand Down Expand Up @@ -321,6 +322,20 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
) -> &'a [chalk_ir::CanonicalVarKind<Self>] {
canonical_var_kinds
}

fn intern_constraints<E>(
&self,
data: impl IntoIterator<Item = Result<chalk_ir::InEnvironment<chalk_ir::Constraint<Self>>, E>>,
) -> Result<Self::InternedConstraints, E> {
data.into_iter().collect::<Result<Vec<_>, _>>()
}

fn constraints_data<'a>(
&self,
constraints: &'a Self::InternedConstraints,
) -> &'a [chalk_ir::InEnvironment<chalk_ir::Constraint<Self>>] {
constraints
}
}

impl<'tcx> chalk_ir::interner::HasInterner for RustInterner<'tcx> {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_traits/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ rustc_hir = { path = "../librustc_hir" }
rustc_index = { path = "../librustc_index" }
rustc_ast = { path = "../librustc_ast" }
rustc_span = { path = "../librustc_span" }
chalk-ir = "0.14.0"
chalk-solve = "0.14.0"
chalk-ir = "0.19.0"
chalk-solve = "0.19.0"
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
rustc_infer = { path = "../librustc_infer" }
rustc_trait_selection = { path = "../librustc_trait_selection" }
27 changes: 10 additions & 17 deletions src/librustc_traits/chalk/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,23 +145,16 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
.map(|(wc, _)| wc.subst(self.tcx, bound_vars))
.filter_map(|wc| LowerInto::<Option<chalk_ir::QuantifiedWhereClause<RustInterner<'tcx>>>>::lower_into(wc, &self.interner))
.collect();
let fields = match adt_def.adt_kind() {
ty::AdtKind::Struct | ty::AdtKind::Union => {
let variant = adt_def.non_enum_variant();
variant
.fields
.iter()
.map(|field| {
self.tcx
.type_of(field.did)
.subst(self.tcx, bound_vars)
.lower_into(&self.interner)
})
.collect()
}
// FIXME(chalk): handle enums; force_impl_for requires this
ty::AdtKind::Enum => vec![],
};

let fields = adt_def
.variants
.iter()
.flat_map(|variant| variant.fields.iter())
.map(|field| {
self.tcx.type_of(field.did).subst(self.tcx, bound_vars).lower_into(&self.interner)
})
.collect();

let struct_datum = Arc::new(chalk_solve::rust_ir::AdtDatum {
id: adt_id,
binders: chalk_ir::Binders::new(
Expand Down
5 changes: 4 additions & 1 deletion src/librustc_traits/chalk/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ crate fn evaluate_goal<'tcx>(
universes: max_universe + 1,
};

let solver_choice = chalk_solve::SolverChoice::SLG { max_size: 32, expected_answers: None };
let solver_choice = chalk_solve::solve::SLGSolver {
max_size: 32,
expected_answers: None,
};
let mut solver = solver_choice.into_solver::<ChalkRustInterner<'tcx>>();

let db = ChalkRustIrDatabase { tcx, interner };
Expand Down