diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-11-30 07:00:31 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-30 07:00:31 +0100 |
| commit | 084bbcc2ca15baa4b79e75b577472fdb98586ecf (patch) | |
| tree | 0995f35317bd73e4986104f374dfec24e5f12890 /compiler | |
| parent | c752eaa7def39823b214cf0b9f7e7016607437ef (diff) | |
| parent | bf4a62c381db9adb252143dacf6738d74ed0ba58 (diff) | |
| download | rust-084bbcc2ca15baa4b79e75b577472fdb98586ecf.tar.gz rust-084bbcc2ca15baa4b79e75b577472fdb98586ecf.zip | |
Rollup merge of #105039 - nnethercote:fix-104769, r=petrochenkov
Fix an ICE parsing a malformed literal in `concat_bytes!`. Fixes #104769. r? `@petrochenkov`
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_builtin_macros/src/concat_bytes.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_builtin_macros/src/concat_bytes.rs b/compiler/rustc_builtin_macros/src/concat_bytes.rs index 87658e60e9d..161e3499584 100644 --- a/compiler/rustc_builtin_macros/src/concat_bytes.rs +++ b/compiler/rustc_builtin_macros/src/concat_bytes.rs @@ -2,6 +2,7 @@ use rustc_ast as ast; use rustc_ast::{ptr::P, tokenstream::TokenStream}; use rustc_errors::Applicability; use rustc_expand::base::{self, DummyResult}; +use rustc_session::errors::report_lit_error; use rustc_span::Span; /// Emits errors for literal expressions that are invalid inside and outside of an array. @@ -68,7 +69,10 @@ fn invalid_type_err( Ok(ast::LitKind::Int(_, _)) => { cx.span_err(span, "numeric literal is not a `u8`"); } - _ => unreachable!(), + Ok(ast::LitKind::ByteStr(_) | ast::LitKind::Byte(_)) => unreachable!(), + Err(err) => { + report_lit_error(&cx.sess.parse_sess, err, token_lit, span); + } } } |
