1
Fork 0

Handle Err in ast::LitKind::to_token_lit.

Fixes #100948.
This commit is contained in:
Nicholas Nethercote 2022-08-25 09:41:48 +10:00
parent a1bea1551b
commit b997af95fc
4 changed files with 32 additions and 1 deletions

View file

@ -199,7 +199,9 @@ impl LitKind {
let symbol = if value { kw::True } else { kw::False };
(token::Bool, symbol, None)
}
LitKind::Err => unreachable!(),
// This only shows up in places like `-Zunpretty=hir` output, so we
// don't bother to produce something useful.
LitKind::Err => (token::Err, Symbol::intern("<bad-literal>"), None),
};
token::Lit::new(kind, symbol, suffix)