Skip to content

Commit 21b44ab

Browse files
committed
Review comments
1 parent 5452311 commit 21b44ab

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

book/src/types/rust_types.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,13 @@ other type without any effect, and so forth.
165165

166166
## Mapping to rustc types
167167

168-
The rustc [`TyVariableKind`] enum has a lot more variants than chalk. This
168+
The rustc [`TyKind`] enum has a lot more variants than chalk. This
169169
section describes how the rustc types can be mapped to chalk
170170
types. The intention is that, at least when transitioning, rustc would
171-
implement the `Interner` trait and would map from the [`TyVariableKind`]
171+
implement the `Interner` trait and would map from the [`TyKind`]
172172
enum to chalk's `TyKind` on the fly, when `data()` is invoked.
173173

174-
[`TyVariableKind`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/enum.TyVariableKind.html
174+
[`TyKind`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/enum.TyKind.html
175175

176176
This section describes how each of rustc's variants can be mapped to
177177
Chalk variants.

chalk-ir/src/lib.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ impl<I: Interner> Ty<I> {
431431

432432
/// If this is a `TyKind::BoundVar(d)`, returns `Some(d)` else `None`.
433433
pub fn bound_var(&self, interner: &I) -> Option<BoundVar> {
434-
if let TyKind::BoundVar(bv) = &self.data(interner).kind {
434+
if let TyKind::BoundVar(bv) = self.kind(interner) {
435435
Some(*bv)
436436
} else {
437437
None
@@ -440,7 +440,7 @@ impl<I: Interner> Ty<I> {
440440

441441
/// If this is a `TyKind::InferenceVar(d)`, returns `Some(d)` else `None`.
442442
pub fn inference_var(&self, interner: &I) -> Option<InferenceVar> {
443-
if let TyKind::InferenceVar(depth, _) = &self.data(interner).kind {
443+
if let TyKind::InferenceVar(depth, _) = self.kind(interner) {
444444
Some(*depth)
445445
} else {
446446
None
@@ -449,7 +449,7 @@ impl<I: Interner> Ty<I> {
449449

450450
/// Returns true if this is a `BoundVar` or an `InferenceVar` of `TyVariableKind::General`.
451451
pub fn is_general_var(&self, interner: &I, binders: &CanonicalVarKinds<I>) -> bool {
452-
match &self.data(interner).kind {
452+
match self.kind(interner) {
453453
TyKind::BoundVar(bv)
454454
if bv.debruijn == DebruijnIndex::INNERMOST
455455
&& binders.at(interner, bv.index).kind
@@ -464,15 +464,15 @@ impl<I: Interner> Ty<I> {
464464

465465
/// Returns true if this is an `Alias`.
466466
pub fn is_alias(&self, interner: &I) -> bool {
467-
match &self.data(interner).kind {
467+
match self.kind(interner) {
468468
TyKind::Alias(..) => true,
469469
_ => false,
470470
}
471471
}
472472

473473
/// Returns true if this is an `IntTy` or `UintTy`.
474474
pub fn is_integer(&self, interner: &I) -> bool {
475-
match &self.data(interner).kind {
475+
match self.kind(interner) {
476476
TyKind::Apply(ApplicationTy {
477477
name: TypeName::Scalar(Scalar::Int(_)),
478478
..
@@ -487,7 +487,7 @@ impl<I: Interner> Ty<I> {
487487

488488
/// Returns true if this is a `FloatTy`.
489489
pub fn is_float(&self, interner: &I) -> bool {
490-
match &self.data(interner).kind {
490+
match self.kind(interner) {
491491
TyKind::Apply(ApplicationTy {
492492
name: TypeName::Scalar(Scalar::Float(_)),
493493
..
@@ -498,7 +498,7 @@ impl<I: Interner> Ty<I> {
498498

499499
/// Returns `Some(adt_id)` if this is an ADT, `None` otherwise
500500
pub fn adt_id(&self, interner: &I) -> Option<AdtId<I>> {
501-
match &self.data(interner).kind {
501+
match self.kind(interner) {
502502
TyKind::Apply(ApplicationTy {
503503
name: TypeName::Adt(adt_id),
504504
..
@@ -2447,7 +2447,7 @@ impl<I: Interner> Substitution<I> {
24472447
self.iter(interner).zip(0..).all(|(generic_arg, index)| {
24482448
let index_db = BoundVar::new(DebruijnIndex::INNERMOST, index);
24492449
match generic_arg.data(interner) {
2450-
GenericArgData::Ty(ty) => match &ty.data(interner).kind {
2450+
GenericArgData::Ty(ty) => match ty.kind(interner) {
24512451
TyKind::BoundVar(depth) => index_db == *depth,
24522452
_ => false,
24532453
},

chalk-solve/src/clauses.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ fn match_ty<I: Interner>(
753753
.db
754754
.opaque_ty_data(opaque_ty.opaque_ty_id)
755755
.to_program_clauses(builder, environment),
756-
TyKind::Function(quantified_ty) => {
756+
TyKind::Function(_quantified_ty) => {
757757
builder.push_fact(WellFormed::Ty(ty.clone()));
758758
}
759759
TyKind::BoundVar(_) | TyKind::InferenceVar(_, _) => return Err(Floundered),

0 commit comments

Comments
 (0)