1
Fork 0

Address review comment and update chalk to 0.36.0

This commit is contained in:
Matthew Jasper 2020-10-29 22:23:58 +00:00
parent acb6a06123
commit 4d60a80713
4 changed files with 41 additions and 41 deletions

View file

@ -460,9 +460,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "chalk-derive" name = "chalk-derive"
version = "0.35.0" version = "0.36.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc6d2895e93c0939074a7a0f525fd549b49da8362dea3def555e4aab95ff64cd" checksum = "9f88ce4deae1dace71e49b7611cfae2d5489de3530d6daba5758043c47ac3a10"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -472,9 +472,9 @@ dependencies = [
[[package]] [[package]]
name = "chalk-engine" name = "chalk-engine"
version = "0.35.0" version = "0.36.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93ed23c35d243ccc2caeae7ba4660a091e74b11c40e441d7849f07d8e71b5cb8" checksum = "0e34c9b1b10616782143d7f49490f91ae94afaf2202de3ab0b2835e78b4f0ccc"
dependencies = [ dependencies = [
"chalk-derive", "chalk-derive",
"chalk-ir", "chalk-ir",
@ -485,9 +485,9 @@ dependencies = [
[[package]] [[package]]
name = "chalk-ir" name = "chalk-ir"
version = "0.35.0" version = "0.36.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40d7f6140cccc889117e7372b6f9cfbc8103c86a1a0269ff6ab868f20ab414d6" checksum = "63362c629c2014ab639b04029070763fb8224df136d1363d30e9ece4c8877da3"
dependencies = [ dependencies = [
"chalk-derive", "chalk-derive",
"lazy_static", "lazy_static",
@ -495,9 +495,9 @@ dependencies = [
[[package]] [[package]]
name = "chalk-solve" name = "chalk-solve"
version = "0.35.0" version = "0.36.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa65b636e64cbfcba31f053da97c32f3e15f2670b3cc620b84231a1656d754ec" checksum = "cac338a67af52a7f50bb2f8232e730a3518ce432dbe303246acfe525ddd838c7"
dependencies = [ dependencies = [
"chalk-derive", "chalk-derive",
"chalk-ir", "chalk-ir",

View file

@ -26,7 +26,7 @@ rustc_index = { path = "../rustc_index" }
rustc_serialize = { path = "../rustc_serialize" } rustc_serialize = { path = "../rustc_serialize" }
rustc_ast = { path = "../rustc_ast" } rustc_ast = { path = "../rustc_ast" }
rustc_span = { path = "../rustc_span" } rustc_span = { path = "../rustc_span" }
chalk-ir = "0.35.0" chalk-ir = "0.36.0"
smallvec = { version = "1.0", features = ["union", "may_dangle"] } smallvec = { version = "1.0", features = ["union", "may_dangle"] }
measureme = "9.0.0" measureme = "9.0.0"
rustc_session = { path = "../rustc_session" } rustc_session = { path = "../rustc_session" }

View file

@ -12,9 +12,9 @@ rustc_hir = { path = "../rustc_hir" }
rustc_index = { path = "../rustc_index" } rustc_index = { path = "../rustc_index" }
rustc_ast = { path = "../rustc_ast" } rustc_ast = { path = "../rustc_ast" }
rustc_span = { path = "../rustc_span" } rustc_span = { path = "../rustc_span" }
chalk-ir = "0.35.0" chalk-ir = "0.36.0"
chalk-solve = "0.35.0" chalk-solve = "0.36.0"
chalk-engine = "0.35.0" chalk-engine = "0.36.0"
smallvec = { version = "1.0", features = ["union", "may_dangle"] } smallvec = { version = "1.0", features = ["union", "may_dangle"] }
rustc_infer = { path = "../rustc_infer" } rustc_infer = { path = "../rustc_infer" }
rustc_trait_selection = { path = "../rustc_trait_selection" } rustc_trait_selection = { path = "../rustc_trait_selection" }

View file

@ -31,6 +31,7 @@
//! not. To lower anything wrapped in a `Binder`, we first deeply find any bound //! not. To lower anything wrapped in a `Binder`, we first deeply find any bound
//! variables from the current `Binder`. //! variables from the current `Binder`.
use rustc_ast::ast;
use rustc_middle::traits::{ChalkEnvironmentAndGoal, ChalkRustInterner as RustInterner}; use rustc_middle::traits::{ChalkEnvironmentAndGoal, ChalkRustInterner as RustInterner};
use rustc_middle::ty::fold::TypeFolder; use rustc_middle::ty::fold::TypeFolder;
use rustc_middle::ty::subst::{GenericArg, GenericArgKind, SubstsRef}; use rustc_middle::ty::subst::{GenericArg, GenericArgKind, SubstsRef};
@ -278,26 +279,14 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::Ty<RustInterner<'tcx>>> for Ty<'tcx> {
} }
ty::Slice(ty) => chalk_ir::TyKind::Slice(ty.lower_into(interner)), ty::Slice(ty) => chalk_ir::TyKind::Slice(ty.lower_into(interner)),
ty::RawPtr(ptr) => match ptr.mutbl { ty::RawPtr(ptr) => {
ast::Mutability::Mut => { chalk_ir::TyKind::Raw(ptr.mutbl.lower_into(interner), ptr.ty.lower_into(interner))
chalk_ir::TyKind::Raw(chalk_ir::Mutability::Mut, ptr.ty.lower_into(interner)) }
} ty::Ref(region, ty, mutability) => chalk_ir::TyKind::Ref(
ast::Mutability::Not => { mutability.lower_into(interner),
chalk_ir::TyKind::Raw(chalk_ir::Mutability::Not, ptr.ty.lower_into(interner)) region.lower_into(interner),
} ty.lower_into(interner),
}, ),
ty::Ref(region, ty, mutability) => match mutability {
ast::Mutability::Mut => chalk_ir::TyKind::Ref(
chalk_ir::Mutability::Mut,
region.lower_into(interner),
ty.lower_into(interner),
),
ast::Mutability::Not => chalk_ir::TyKind::Ref(
chalk_ir::Mutability::Not,
region.lower_into(interner),
ty.lower_into(interner),
),
},
ty::FnDef(def_id, substs) => { ty::FnDef(def_id, substs) => {
chalk_ir::TyKind::FnDef(chalk_ir::FnDefId(def_id), substs.lower_into(interner)) chalk_ir::TyKind::FnDef(chalk_ir::FnDefId(def_id), substs.lower_into(interner))
} }
@ -356,7 +345,6 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::Ty<RustInterner<'tcx>>> for Ty<'tcx> {
impl<'tcx> LowerInto<'tcx, Ty<'tcx>> for &chalk_ir::Ty<RustInterner<'tcx>> { impl<'tcx> LowerInto<'tcx, Ty<'tcx>> for &chalk_ir::Ty<RustInterner<'tcx>> {
fn lower_into(self, interner: &RustInterner<'tcx>) -> Ty<'tcx> { fn lower_into(self, interner: &RustInterner<'tcx>) -> Ty<'tcx> {
use chalk_ir::TyKind; use chalk_ir::TyKind;
use rustc_ast::ast;
let kind = match self.kind(interner) { let kind = match self.kind(interner) {
TyKind::Adt(struct_id, substitution) => { TyKind::Adt(struct_id, substitution) => {
@ -402,18 +390,12 @@ impl<'tcx> LowerInto<'tcx, Ty<'tcx>> for &chalk_ir::Ty<RustInterner<'tcx>> {
TyKind::Slice(ty) => ty::Slice(ty.lower_into(interner)), TyKind::Slice(ty) => ty::Slice(ty.lower_into(interner)),
TyKind::Raw(mutbl, ty) => ty::RawPtr(ty::TypeAndMut { TyKind::Raw(mutbl, ty) => ty::RawPtr(ty::TypeAndMut {
ty: ty.lower_into(interner), ty: ty.lower_into(interner),
mutbl: match mutbl { mutbl: mutbl.lower_into(interner),
chalk_ir::Mutability::Mut => ast::Mutability::Mut,
chalk_ir::Mutability::Not => ast::Mutability::Not,
},
}), }),
TyKind::Ref(mutbl, lifetime, ty) => ty::Ref( TyKind::Ref(mutbl, lifetime, ty) => ty::Ref(
lifetime.lower_into(interner), lifetime.lower_into(interner),
ty.lower_into(interner), ty.lower_into(interner),
match mutbl { mutbl.lower_into(interner),
chalk_ir::Mutability::Mut => ast::Mutability::Mut,
chalk_ir::Mutability::Not => ast::Mutability::Not,
},
), ),
TyKind::Str => ty::Str, TyKind::Str => ty::Str,
TyKind::OpaqueType(opaque_ty, substitution) => { TyKind::OpaqueType(opaque_ty, substitution) => {
@ -767,6 +749,24 @@ impl<'tcx> LowerInto<'tcx, chalk_solve::rust_ir::TraitBound<RustInterner<'tcx>>>
} }
} }
impl<'tcx> LowerInto<'tcx, chalk_ir::Mutability> for ast::Mutability {
fn lower_into(self, _interner: &RustInterner<'tcx>) -> chalk_ir::Mutability {
match self {
rustc_ast::Mutability::Mut => chalk_ir::Mutability::Mut,
rustc_ast::Mutability::Not => chalk_ir::Mutability::Not,
}
}
}
impl<'tcx> LowerInto<'tcx, ast::Mutability> for chalk_ir::Mutability {
fn lower_into(self, _interner: &RustInterner<'tcx>) -> ast::Mutability {
match self {
chalk_ir::Mutability::Mut => ast::Mutability::Mut,
chalk_ir::Mutability::Not => ast::Mutability::Not,
}
}
}
impl<'tcx> LowerInto<'tcx, chalk_solve::rust_ir::Polarity> for ty::ImplPolarity { impl<'tcx> LowerInto<'tcx, chalk_solve::rust_ir::Polarity> for ty::ImplPolarity {
fn lower_into(self, _interner: &RustInterner<'tcx>) -> chalk_solve::rust_ir::Polarity { fn lower_into(self, _interner: &RustInterner<'tcx>) -> chalk_solve::rust_ir::Polarity {
match self { match self {