Skip to content

Commit 3eab21e

Browse files
committed
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`.
1 parent 8a6831a commit 3eab21e

File tree

1 file changed

+3
-3
lines changed
  • compiler/rustc_middle/src/ty

1 file changed

+3
-3
lines changed

compiler/rustc_middle/src/ty/sty.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,13 @@ impl TyKind<'tcx> {
212212
}
213213

214214
/// Get the article ("a" or "an") to use with this type.
215-
///
216-
/// **Panics if `self` is [`TyKind::Error`].**
217215
pub fn article(&self) -> &'static str {
218216
match self {
219217
Int(_) | Float(_) | Array(_, _) => "an",
220218
Adt(def, _) if def.is_enum() => "an",
221-
Error(_) => panic!(),
219+
// This should never happen, but ICEing and causing the user's code
220+
// to not compile felt too harsh.
221+
Error(_) => "a",
222222
_ => "a",
223223
}
224224
}

0 commit comments

Comments
 (0)