diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-08-25 09:41:48 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-08-25 10:50:39 +1000 |
| commit | b997af95fce1f1295f3b90ae33c575b6ded4f914 (patch) | |
| tree | 0cf5d7fd9c9404696d17e942ef69e5e30cb30061 /compiler | |
| parent | a1bea1551b8312b6abfbbf7d49bafac2e6ce8ee4 (diff) | |
| download | rust-b997af95fce1f1295f3b90ae33c575b6ded4f914.tar.gz rust-b997af95fce1f1295f3b90ae33c575b6ded4f914.zip | |
Handle `Err` in `ast::LitKind::to_token_lit`.
Fixes #100948.
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_ast/src/util/literal.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_ast/src/util/literal.rs b/compiler/rustc_ast/src/util/literal.rs index 6a02a3b56f6..69a78d165ef 100644 --- a/compiler/rustc_ast/src/util/literal.rs +++ b/compiler/rustc_ast/src/util/literal.rs @@ -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) |
