Repository navigation
ref(vlq): Overhaul API - #145
loewenheim wants to merge 9 commits into
Conversation
| use crate::errors::{Error, Result}; | ||
|
|
||
| const B64_CHARS: &[u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | ||
| const B64: [i8; 256] = [ |
There was a problem hiding this comment.
We now manually check that a character is ASCII before accessing this array, meaning the latter 128 slots are pointless.
| if running_name_id >= names.len() as u32 { | ||
| return Err(Error::BadNameReference(running_name_id)); | ||
| } | ||
| current_name_id = running_name_id; |
There was a problem hiding this comment.
Negative source or name deltas clamp to zero
Low Severity
running_src_id and running_name_id now update via saturating_add_signed, so a negative delta that underflows below 0 silently clamps to index 0 instead of failing the bounds check with Error::BadSourceReference or Error::BadNameReference.
Reviewed by Cursor Bugbot for commit 7f90cc0. Configure here.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ba0394a. Configure here.
| if val.highest_one().is_some_and(|idx| idx + shift >= 32) { | ||
| return Err(Error::VlqOverflow); | ||
| } |
There was a problem hiding this comment.
Vlq::decode calls non-existent u32::highest_one
val.highest_one() is not a stable u32 method, so this crate fails to compile on the stable toolchain used by CI. Use checked_ilog2() (or an equivalent bit-width check) instead.
Evidence
Vlq::decodecallsval.highest_one()on au32(src/vlq.rsline 86).- No local trait, helper, or
#![feature(...)]gate defineshighest_onefor integers. .github/workflows/ci.ymlinstalls and builds with stable Rust (cargo test/cargo clippy), which does not provide this method.
Identified by Warden · code-review · R28-MZL
There was a problem hiding this comment.
Stable since 1.97.0.


This removes the
vlqmodule from the public API (a breaking change) and totally reworks its API:u32/i32since sourcemap VLQs are restricted to that value range by the spec. No morei64everywhere.Vlq, a newtype around au32. The inner value cannot be accessed directly; you need to usesignedorunsigneddepending on whether the number is to be interpreted as ai32oru32.decode_vlqsfunction returns aFallibleIteratorthat reads VLQs one by one off the front of a string slice.Displayimpl.