diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs index 9e60253106b8..e049341659c8 100644 --- a/compiler/rustc_middle/src/ty/sty.rs +++ b/compiler/rustc_middle/src/ty/sty.rs @@ -212,13 +212,13 @@ impl TyKind<'tcx> { } /// Get the article ("a" or "an") to use with this type. - /// - /// **Panics if `self` is [`TyKind::Error`].** pub fn article(&self) -> &'static str { match self { Int(_) | Float(_) | Array(_, _) => "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", } }