Skip to content

Commit

Permalink
Address review comment and update chalk to 0.36.0
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewjasper committed Oct 30, 2020
1 parent acb6a06 commit 4d60a80
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 41 deletions.
16 changes: 8 additions & 8 deletions Cargo.lock
Expand Up @@ -460,9 +460,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"

[[package]]
name = "chalk-derive"
version = "0.35.0"
version = "0.36.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc6d2895e93c0939074a7a0f525fd549b49da8362dea3def555e4aab95ff64cd"
checksum = "9f88ce4deae1dace71e49b7611cfae2d5489de3530d6daba5758043c47ac3a10"
dependencies = [
"proc-macro2",
"quote",
Expand All @@ -472,9 +472,9 @@ dependencies = [

[[package]]
name = "chalk-engine"
version = "0.35.0"
version = "0.36.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93ed23c35d243ccc2caeae7ba4660a091e74b11c40e441d7849f07d8e71b5cb8"
checksum = "0e34c9b1b10616782143d7f49490f91ae94afaf2202de3ab0b2835e78b4f0ccc"
dependencies = [
"chalk-derive",
"chalk-ir",
Expand All @@ -485,19 +485,19 @@ dependencies = [

[[package]]
name = "chalk-ir"
version = "0.35.0"
version = "0.36.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40d7f6140cccc889117e7372b6f9cfbc8103c86a1a0269ff6ab868f20ab414d6"
checksum = "63362c629c2014ab639b04029070763fb8224df136d1363d30e9ece4c8877da3"
dependencies = [
"chalk-derive",
"lazy_static",
]

[[package]]
name = "chalk-solve"
version = "0.35.0"
version = "0.36.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa65b636e64cbfcba31f053da97c32f3e15f2670b3cc620b84231a1656d754ec"
checksum = "cac338a67af52a7f50bb2f8232e730a3518ce432dbe303246acfe525ddd838c7"
dependencies = [
"chalk-derive",
"chalk-ir",
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/Cargo.toml
Expand Up @@ -26,7 +26,7 @@ rustc_index = { path = "../rustc_index" }
rustc_serialize = { path = "../rustc_serialize" }
rustc_ast = { path = "../rustc_ast" }
rustc_span = { path = "../rustc_span" }
chalk-ir = "0.35.0"
chalk-ir = "0.36.0"
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
measureme = "9.0.0"
rustc_session = { path = "../rustc_session" }
6 changes: 3 additions & 3 deletions compiler/rustc_traits/Cargo.toml
Expand Up @@ -12,9 +12,9 @@ rustc_hir = { path = "../rustc_hir" }
rustc_index = { path = "../rustc_index" }
rustc_ast = { path = "../rustc_ast" }
rustc_span = { path = "../rustc_span" }
chalk-ir = "0.35.0"
chalk-solve = "0.35.0"
chalk-engine = "0.35.0"
chalk-ir = "0.36.0"
chalk-solve = "0.36.0"
chalk-engine = "0.36.0"
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
rustc_infer = { path = "../rustc_infer" }
rustc_trait_selection = { path = "../rustc_trait_selection" }
58 changes: 29 additions & 29 deletions compiler/rustc_traits/src/chalk/lowering.rs
Expand Up @@ -31,6 +31,7 @@
//! not. To lower anything wrapped in a `Binder`, we first deeply find any bound
//! variables from the current `Binder`.

use rustc_ast::ast;
use rustc_middle::traits::{ChalkEnvironmentAndGoal, ChalkRustInterner as RustInterner};
use rustc_middle::ty::fold::TypeFolder;
use rustc_middle::ty::subst::{GenericArg, GenericArgKind, SubstsRef};
Expand Down Expand Up @@ -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::RawPtr(ptr) => match ptr.mutbl {
ast::Mutability::Mut => {
chalk_ir::TyKind::Raw(chalk_ir::Mutability::Mut, ptr.ty.lower_into(interner))
}
ast::Mutability::Not => {
chalk_ir::TyKind::Raw(chalk_ir::Mutability::Not, ptr.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::RawPtr(ptr) => {
chalk_ir::TyKind::Raw(ptr.mutbl.lower_into(interner), ptr.ty.lower_into(interner))
}
ty::Ref(region, ty, mutability) => chalk_ir::TyKind::Ref(
mutability.lower_into(interner),
region.lower_into(interner),
ty.lower_into(interner),
),
ty::FnDef(def_id, substs) => {
chalk_ir::TyKind::FnDef(chalk_ir::FnDefId(def_id), substs.lower_into(interner))
}
Expand Down Expand Up @@ -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>> {
fn lower_into(self, interner: &RustInterner<'tcx>) -> Ty<'tcx> {
use chalk_ir::TyKind;
use rustc_ast::ast;

let kind = match self.kind(interner) {
TyKind::Adt(struct_id, substitution) => {
Expand Down Expand Up @@ -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::Raw(mutbl, ty) => ty::RawPtr(ty::TypeAndMut {
ty: ty.lower_into(interner),
mutbl: match mutbl {
chalk_ir::Mutability::Mut => ast::Mutability::Mut,
chalk_ir::Mutability::Not => ast::Mutability::Not,
},
mutbl: mutbl.lower_into(interner),
}),
TyKind::Ref(mutbl, lifetime, ty) => ty::Ref(
lifetime.lower_into(interner),
ty.lower_into(interner),
match mutbl {
chalk_ir::Mutability::Mut => ast::Mutability::Mut,
chalk_ir::Mutability::Not => ast::Mutability::Not,
},
mutbl.lower_into(interner),
),
TyKind::Str => ty::Str,
TyKind::OpaqueType(opaque_ty, substitution) => {
Expand Down Expand Up @@ -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 {
fn lower_into(self, _interner: &RustInterner<'tcx>) -> chalk_solve::rust_ir::Polarity {
match self {
Expand Down

0 comments on commit 4d60a80

Please sign in to comment.