Fix missing match arms

This commit is contained in:
Florian Diebold 2021-04-08 13:51:04 +02:00
parent f43edb2151
commit a838a60caa
5 changed files with 23 additions and 3 deletions

View file

@ -1903,7 +1903,9 @@ impl Type {
| TyKind::Dyn(_)
| TyKind::Function(_)
| TyKind::Alias(_)
| TyKind::Foreign(_) => false,
| TyKind::Foreign(_)
| TyKind::Generator(..)
| TyKind::GeneratorWitness(..) => false,
}
}
}

View file

@ -287,6 +287,8 @@ impl HirDisplay for GenericArg {
fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
match self.interned() {
crate::GenericArgData::Ty(ty) => ty.hir_fmt(f),
crate::GenericArgData::Lifetime(lt) => lt.hir_fmt(f),
crate::GenericArgData::Const(c) => c.hir_fmt(f),
}
}
}
@ -664,6 +666,8 @@ impl HirDisplay for Ty {
write!(f, "{{unknown}}")?;
}
TyKind::InferenceVar(..) => write!(f, "_")?,
TyKind::Generator(..) => write!(f, "{{generator}}")?,
TyKind::GeneratorWitness(..) => write!(f, "{{generator witness}}")?,
}
Ok(())
}
@ -741,7 +745,7 @@ fn write_bounds_like_dyn_trait(
if !first {
write!(f, " + ")?;
}
// We assume that the self type is $0 (i.e. the
// We assume that the self type is ^0.0 (i.e. the
// existential) here, which is the only thing that's
// possible in actual Rust, and hence don't print it
write!(f, "{}", f.db.trait_data(trait_).name)?;
@ -783,6 +787,10 @@ fn write_bounds_like_dyn_trait(
}
ty.hir_fmt(f)?;
}
// FIXME implement these
WhereClause::LifetimeOutlives(_) => {}
WhereClause::TypeOutlives(_) => {}
}
first = false;
}
@ -837,6 +845,10 @@ impl HirDisplay for WhereClause {
ty.hir_fmt(f)?;
}
WhereClause::AliasEq(_) => write!(f, "{{error}}")?,
// FIXME implement these
WhereClause::TypeOutlives(..) => {}
WhereClause::LifetimeOutlives(..) => {}
}
Ok(())
}
@ -881,9 +893,11 @@ impl HirDisplay for DomainGoal {
DomainGoal::Holds(wc) => {
write!(f, "Holds(")?;
wc.hir_fmt(f)?;
write!(f, ")")
write!(f, ")")?;
}
_ => write!(f, "?")?,
}
Ok(())
}
}

View file

@ -116,6 +116,7 @@ impl<'a, 'b> Canonicalizer<'a, 'b> {
DomainGoal::Holds(wc) => {
DomainGoal::Holds(self.do_canonicalize(wc, DebruijnIndex::INNERMOST))
}
_ => unimplemented!(),
};
self.into_canonicalized(InEnvironment { goal: result, environment: obligation.environment })
}

View file

@ -81,6 +81,7 @@ pub(crate) fn trait_solve_query(
db.trait_data(it.hir_trait_id()).name.to_string()
}
DomainGoal::Holds(WhereClause::AliasEq(_)) => "alias_eq".to_string(),
_ => "??".to_string(),
});
log::info!("trait_solve_query({})", goal.value.goal.display(db));

View file

@ -93,6 +93,7 @@ impl TypeWalk for GenericArg {
GenericArgData::Ty(ty) => {
ty.walk(f);
}
_ => {}
}
}
}
@ -122,6 +123,7 @@ impl TypeWalk for WhereClause {
match self {
WhereClause::Implemented(trait_ref) => trait_ref.walk(f),
WhereClause::AliasEq(alias_eq) => alias_eq.walk(f),
_ => {}
}
}
}