diff options
| author | Josh Stone <jistone@redhat.com> | 2024-01-17 15:40:30 -0800 |
|---|---|---|
| committer | Josh Stone <jistone@redhat.com> | 2024-01-19 20:10:39 -0800 |
| commit | 33e04228262cb7ac76023a94d3811e62518cfc42 (patch) | |
| tree | 060ca76f9a0219acd9f28cc8bf10ef254acb3f31 /compiler/rustc_builtin_macros/src/concat_bytes.rs | |
| parent | 167555f36a3b3e7f4a0a685c63d928bbd32f1157 (diff) | |
| download | rust-33e04228262cb7ac76023a94d3811e62518cfc42.tar.gz rust-33e04228262cb7ac76023a94d3811e62518cfc42.zip | |
Pack the u128 in LitKind::Int
Diffstat (limited to 'compiler/rustc_builtin_macros/src/concat_bytes.rs')
| -rw-r--r-- | compiler/rustc_builtin_macros/src/concat_bytes.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_builtin_macros/src/concat_bytes.rs b/compiler/rustc_builtin_macros/src/concat_bytes.rs index 4f7c0266343..a01bbeac824 100644 --- a/compiler/rustc_builtin_macros/src/concat_bytes.rs +++ b/compiler/rustc_builtin_macros/src/concat_bytes.rs @@ -54,7 +54,7 @@ fn invalid_type_err( val, ast::LitIntType::Unsuffixed | ast::LitIntType::Unsigned(ast::UintTy::U8), )) => { - assert!(val > u8::MAX.into()); // must be an error + assert!(val.get() > u8::MAX.into()); // must be an error dcx.emit_err(ConcatBytesOob { span }); } Ok(ast::LitKind::Int(_, _)) => { @@ -86,7 +86,7 @@ fn handle_array_element( Ok(ast::LitKind::Int( val, ast::LitIntType::Unsuffixed | ast::LitIntType::Unsigned(ast::UintTy::U8), - )) if val <= u8::MAX.into() => Some(val as u8), + )) if val.get() <= u8::MAX.into() => Some(val.get() as u8), Ok(ast::LitKind::Byte(val)) => Some(val), Ok(ast::LitKind::ByteStr(..)) => { @@ -148,7 +148,7 @@ pub fn expand_concat_bytes( if let Some(elem) = handle_array_element(cx, &mut has_errors, &mut missing_literals, expr) { - for _ in 0..count_val { + for _ in 0..count_val.get() { accumulator.push(elem); } } |
