Don't ICE if called with a TyKind::Error
It felt too harsh to estebank and others to ICE even though it's technically a mistake to show a `TyKind::Error`.
This commit is contained in:
parent
8a6831a7fd
commit
3eab21e22d
1 changed files with 3 additions and 3 deletions
|
@ -212,13 +212,13 @@ impl TyKind<'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the article ("a" or "an") to use with this type.
|
/// Get the article ("a" or "an") to use with this type.
|
||||||
///
|
|
||||||
/// **Panics if `self` is [`TyKind::Error`].**
|
|
||||||
pub fn article(&self) -> &'static str {
|
pub fn article(&self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
Int(_) | Float(_) | Array(_, _) => "an",
|
Int(_) | Float(_) | Array(_, _) => "an",
|
||||||
Adt(def, _) if def.is_enum() => "an",
|
Adt(def, _) if def.is_enum() => "an",
|
||||||
Error(_) => panic!(),
|
// This should never happen, but ICEing and causing the user's code
|
||||||
|
// to not compile felt too harsh.
|
||||||
|
Error(_) => "a",
|
||||||
_ => "a",
|
_ => "a",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue