Skip to content

Commit a838a60

Browse files
committed
Fix missing match arms
1 parent f43edb2 commit a838a60

File tree

5 files changed

+23
-3
lines changed

5 files changed

+23
-3
lines changed

crates/hir/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1903,7 +1903,9 @@ impl Type {
19031903
| TyKind::Dyn(_)
19041904
| TyKind::Function(_)
19051905
| TyKind::Alias(_)
1906-
| TyKind::Foreign(_) => false,
1906+
| TyKind::Foreign(_)
1907+
| TyKind::Generator(..)
1908+
| TyKind::GeneratorWitness(..) => false,
19071909
}
19081910
}
19091911
}

crates/hir_ty/src/display.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ impl HirDisplay for GenericArg {
287287
fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
288288
match self.interned() {
289289
crate::GenericArgData::Ty(ty) => ty.hir_fmt(f),
290+
crate::GenericArgData::Lifetime(lt) => lt.hir_fmt(f),
291+
crate::GenericArgData::Const(c) => c.hir_fmt(f),
290292
}
291293
}
292294
}
@@ -664,6 +666,8 @@ impl HirDisplay for Ty {
664666
write!(f, "{{unknown}}")?;
665667
}
666668
TyKind::InferenceVar(..) => write!(f, "_")?,
669+
TyKind::Generator(..) => write!(f, "{{generator}}")?,
670+
TyKind::GeneratorWitness(..) => write!(f, "{{generator witness}}")?,
667671
}
668672
Ok(())
669673
}
@@ -741,7 +745,7 @@ fn write_bounds_like_dyn_trait(
741745
if !first {
742746
write!(f, " + ")?;
743747
}
744-
// We assume that the self type is $0 (i.e. the
748+
// We assume that the self type is ^0.0 (i.e. the
745749
// existential) here, which is the only thing that's
746750
// possible in actual Rust, and hence don't print it
747751
write!(f, "{}", f.db.trait_data(trait_).name)?;
@@ -783,6 +787,10 @@ fn write_bounds_like_dyn_trait(
783787
}
784788
ty.hir_fmt(f)?;
785789
}
790+
791+
// FIXME implement these
792+
WhereClause::LifetimeOutlives(_) => {}
793+
WhereClause::TypeOutlives(_) => {}
786794
}
787795
first = false;
788796
}
@@ -837,6 +845,10 @@ impl HirDisplay for WhereClause {
837845
ty.hir_fmt(f)?;
838846
}
839847
WhereClause::AliasEq(_) => write!(f, "{{error}}")?,
848+
849+
// FIXME implement these
850+
WhereClause::TypeOutlives(..) => {}
851+
WhereClause::LifetimeOutlives(..) => {}
840852
}
841853
Ok(())
842854
}
@@ -881,9 +893,11 @@ impl HirDisplay for DomainGoal {
881893
DomainGoal::Holds(wc) => {
882894
write!(f, "Holds(")?;
883895
wc.hir_fmt(f)?;
884-
write!(f, ")")
896+
write!(f, ")")?;
885897
}
898+
_ => write!(f, "?")?,
886899
}
900+
Ok(())
887901
}
888902
}
889903

crates/hir_ty/src/infer/unify.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ impl<'a, 'b> Canonicalizer<'a, 'b> {
116116
DomainGoal::Holds(wc) => {
117117
DomainGoal::Holds(self.do_canonicalize(wc, DebruijnIndex::INNERMOST))
118118
}
119+
_ => unimplemented!(),
119120
};
120121
self.into_canonicalized(InEnvironment { goal: result, environment: obligation.environment })
121122
}

crates/hir_ty/src/traits.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ pub(crate) fn trait_solve_query(
8181
db.trait_data(it.hir_trait_id()).name.to_string()
8282
}
8383
DomainGoal::Holds(WhereClause::AliasEq(_)) => "alias_eq".to_string(),
84+
_ => "??".to_string(),
8485
});
8586
log::info!("trait_solve_query({})", goal.value.goal.display(db));
8687

crates/hir_ty/src/walk.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ impl TypeWalk for GenericArg {
9393
GenericArgData::Ty(ty) => {
9494
ty.walk(f);
9595
}
96+
_ => {}
9697
}
9798
}
9899
}
@@ -122,6 +123,7 @@ impl TypeWalk for WhereClause {
122123
match self {
123124
WhereClause::Implemented(trait_ref) => trait_ref.walk(f),
124125
WhereClause::AliasEq(alias_eq) => alias_eq.walk(f),
126+
_ => {}
125127
}
126128
}
127129
}

0 commit comments

Comments
 (0)