Skip to content

Commit 0aed74a

Browse files
authored
Rollup merge of #78502 - matthewjasper:chalkup, r=nikomatsakis
Update Chalk to 0.36.0 This PR updates Chalk and fixes a number of bugs in the chalk integration code. cc `@rust-lang/wg-traits` r? `@nikomatsakis`
2 parents 2187f3c + 4d60a80 commit 0aed74a

File tree

11 files changed

+384
-355
lines changed

11 files changed

+384
-355
lines changed

Cargo.lock

+8-8
Original file line numberDiff line numberDiff line change
@@ -460,9 +460,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
460460

461461
[[package]]
462462
name = "chalk-derive"
463-
version = "0.32.0"
463+
version = "0.36.0"
464464
source = "registry+https://github.com/rust-lang/crates.io-index"
465-
checksum = "2d072b2ba723f0bada7c515d8b3725224bc4f5052d2a92dcbeb0b118ff37084a"
465+
checksum = "9f88ce4deae1dace71e49b7611cfae2d5489de3530d6daba5758043c47ac3a10"
466466
dependencies = [
467467
"proc-macro2",
468468
"quote",
@@ -472,9 +472,9 @@ dependencies = [
472472

473473
[[package]]
474474
name = "chalk-engine"
475-
version = "0.32.0"
475+
version = "0.36.0"
476476
source = "registry+https://github.com/rust-lang/crates.io-index"
477-
checksum = "6fb5475f6083d6d6c509e1c335c4f69ad04144ac090faa1afb134a53c3695841"
477+
checksum = "0e34c9b1b10616782143d7f49490f91ae94afaf2202de3ab0b2835e78b4f0ccc"
478478
dependencies = [
479479
"chalk-derive",
480480
"chalk-ir",
@@ -485,19 +485,19 @@ dependencies = [
485485

486486
[[package]]
487487
name = "chalk-ir"
488-
version = "0.32.0"
488+
version = "0.36.0"
489489
source = "registry+https://github.com/rust-lang/crates.io-index"
490-
checksum = "f60cdb0e18c5455cb6a85e8464aad3622b70476018edfa8845691df66f7e9a05"
490+
checksum = "63362c629c2014ab639b04029070763fb8224df136d1363d30e9ece4c8877da3"
491491
dependencies = [
492492
"chalk-derive",
493493
"lazy_static",
494494
]
495495

496496
[[package]]
497497
name = "chalk-solve"
498-
version = "0.32.0"
498+
version = "0.36.0"
499499
source = "registry+https://github.com/rust-lang/crates.io-index"
500-
checksum = "981534d499a8476ecc0b520be4d3864757f96211826a75360fbf2cb6fae362ab"
500+
checksum = "cac338a67af52a7f50bb2f8232e730a3518ce432dbe303246acfe525ddd838c7"
501501
dependencies = [
502502
"chalk-derive",
503503
"chalk-ir",

compiler/rustc_middle/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ rustc_index = { path = "../rustc_index" }
2626
rustc_serialize = { path = "../rustc_serialize" }
2727
rustc_ast = { path = "../rustc_ast" }
2828
rustc_span = { path = "../rustc_span" }
29-
chalk-ir = "0.32.0"
29+
chalk-ir = "0.36.0"
3030
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
3131
measureme = "9.0.0"
3232
rustc_session = { path = "../rustc_session" }

compiler/rustc_middle/src/traits/chalk.rs

+26-42
Original file line numberDiff line numberDiff line change
@@ -102,48 +102,6 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
102102
Some(write())
103103
}
104104

105-
fn debug_application_ty(
106-
application_ty: &chalk_ir::ApplicationTy<Self>,
107-
fmt: &mut fmt::Formatter<'_>,
108-
) -> Option<fmt::Result> {
109-
match application_ty.name {
110-
chalk_ir::TypeName::Ref(mutbl) => {
111-
let data = application_ty.substitution.interned();
112-
match (&**data[0].interned(), &**data[1].interned()) {
113-
(
114-
chalk_ir::GenericArgData::Lifetime(lifetime),
115-
chalk_ir::GenericArgData::Ty(ty),
116-
) => Some(match mutbl {
117-
chalk_ir::Mutability::Not => write!(fmt, "(&{:?} {:?})", lifetime, ty),
118-
chalk_ir::Mutability::Mut => write!(fmt, "(&{:?} mut {:?})", lifetime, ty),
119-
}),
120-
_ => unreachable!(),
121-
}
122-
}
123-
chalk_ir::TypeName::Array => {
124-
let data = application_ty.substitution.interned();
125-
match (&**data[0].interned(), &**data[1].interned()) {
126-
(chalk_ir::GenericArgData::Ty(ty), chalk_ir::GenericArgData::Const(len)) => {
127-
Some(write!(fmt, "[{:?}; {:?}]", ty, len))
128-
}
129-
_ => unreachable!(),
130-
}
131-
}
132-
chalk_ir::TypeName::Slice => {
133-
let data = application_ty.substitution.interned();
134-
let ty = match &**data[0].interned() {
135-
chalk_ir::GenericArgData::Ty(t) => t,
136-
_ => unreachable!(),
137-
};
138-
Some(write!(fmt, "[{:?}]", ty))
139-
}
140-
_ => {
141-
let chalk_ir::ApplicationTy { name, substitution } = application_ty;
142-
Some(write!(fmt, "{:?}{:?}", name, chalk_ir::debug::Angle(substitution.interned())))
143-
}
144-
}
145-
}
146-
147105
fn debug_substitution(
148106
substitution: &chalk_ir::Substitution<Self>,
149107
fmt: &mut fmt::Formatter<'_>,
@@ -174,6 +132,32 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
174132
Some(write!(fmt, "{:?}", clauses.interned()))
175133
}
176134

135+
fn debug_ty(ty: &chalk_ir::Ty<Self>, fmt: &mut fmt::Formatter<'_>) -> Option<fmt::Result> {
136+
match &ty.interned().kind {
137+
chalk_ir::TyKind::Ref(chalk_ir::Mutability::Not, lifetime, ty) => {
138+
Some(write!(fmt, "(&{:?} {:?})", lifetime, ty))
139+
}
140+
chalk_ir::TyKind::Ref(chalk_ir::Mutability::Mut, lifetime, ty) => {
141+
Some(write!(fmt, "(&{:?} mut {:?})", lifetime, ty))
142+
}
143+
chalk_ir::TyKind::Array(ty, len) => Some(write!(fmt, "[{:?}; {:?}]", ty, len)),
144+
chalk_ir::TyKind::Slice(ty) => Some(write!(fmt, "[{:?}]", ty)),
145+
chalk_ir::TyKind::Tuple(len, substs) => Some((|| {
146+
write!(fmt, "(")?;
147+
for (idx, substitution) in substs.interned().iter().enumerate() {
148+
if idx == *len && *len != 1 {
149+
// Don't add a trailing comma if the tuple has more than one element
150+
write!(fmt, "{:?}", substitution)?;
151+
} else {
152+
write!(fmt, "{:?},", substitution)?;
153+
}
154+
}
155+
write!(fmt, ")")
156+
})()),
157+
_ => None,
158+
}
159+
}
160+
177161
fn debug_alias(
178162
alias_ty: &chalk_ir::AliasTy<Self>,
179163
fmt: &mut fmt::Formatter<'_>,

compiler/rustc_middle/src/ty/print/pretty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ thread_local! {
6363
/// Avoids running any queries during any prints that occur
6464
/// during the closure. This may alter the appearance of some
6565
/// types (e.g. forcing verbose printing for opaque types).
66-
/// This method is used during some queries (e.g. `predicates_of`
66+
/// This method is used during some queries (e.g. `explicit_item_bounds`
6767
/// for opaque types), to ensure that any debug printing that
6868
/// occurs during the query computation does not end up recursively
6969
/// calling the same query.

compiler/rustc_traits/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ rustc_hir = { path = "../rustc_hir" }
1212
rustc_index = { path = "../rustc_index" }
1313
rustc_ast = { path = "../rustc_ast" }
1414
rustc_span = { path = "../rustc_span" }
15-
chalk-ir = "0.32.0"
16-
chalk-solve = "0.32.0"
17-
chalk-engine = "0.32.0"
15+
chalk-ir = "0.36.0"
16+
chalk-solve = "0.36.0"
17+
chalk-engine = "0.36.0"
1818
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
1919
rustc_infer = { path = "../rustc_infer" }
2020
rustc_trait_selection = { path = "../rustc_trait_selection" }

0 commit comments

Comments
 (0)