We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
TyKind::Error
1 parent 8a6831a commit 3eab21eCopy full SHA for 3eab21e
compiler/rustc_middle/src/ty/sty.rs
@@ -212,13 +212,13 @@ impl TyKind<'tcx> {
212
}
213
214
/// Get the article ("a" or "an") to use with this type.
215
- ///
216
- /// **Panics if `self` is [`TyKind::Error`].**
217
pub fn article(&self) -> &'static str {
218
match self {
219
Int(_) | Float(_) | Array(_, _) => "an",
220
Adt(def, _) if def.is_enum() => "an",
221
- Error(_) => panic!(),
+ // This should never happen, but ICEing and causing the user's code
+ // to not compile felt too harsh.
+ Error(_) => "a",
222
_ => "a",
223
224
0 commit comments