Repository navigation
Rust JSG: rename jsg_traced! to jsg_traced_unchecked! - #8518
Conversation
#[jsg_traced] checks that every field holds no GC references, and jsg::jsg_traced! makes the same claim without checking it. The two differ only by sigil, so a call site doesn't show which guarantee it gives. In this patch the macro_rules macro is jsg_traced_unchecked!, so each call site says that it skips the field check. The test structs in jsg-test whose fields are plain data move to #[jsg_traced]. The ones that stay unchecked are the two DropCounters, which hold a &'static AtomicUsize, and the Conversion enum. The docs name #[jsg_traced] first. Nothing changes at runtime.
There was a problem hiding this comment.
✅ Approved — This is a complete, mechanical rename. The test structs moved to #[jsg_traced] hold only plain data, and nothing changes at runtime.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
🔒 Security: ✅ LGTM
This is a rename only, with no security impact.
📖 AGENTS.md: ✅ LGTM
The src/rust/AGENTS.md update matches the rename, including the generic form.
📋 Code Quality: ✅ LGTM
The rename is complete; no jsg_traced! reference remains. The structs moved to #[jsg_traced] have field types that all implement HoldsNoGcReferences. The ones that stay unchecked hold a type that can't implement the marker, or use a generic form the attribute macro doesn't cover.
⚡ Performance: ✅ LGTM
Nothing changes at runtime.
📝 Documentation: ✅ LGTM
The README and checklist updates match the new macro name and describe the checked and unchecked forms correctly.
Reviewed commit: b0c45c3d
guybedford
left a comment
There was a problem hiding this comment.
Two of the sites that stay unchecked are down to gaps in #[jsg_traced] rather than foreign types (see inline). Closing those two gaps would leave the unchecked macro for foreign types only, which is what the docs say it is for. That is follow-up material, not for this PR.
#[jsg_traced]checks that every field holds no GC references, andjsg::jsg_traced!makes the same claim without checking it. The two differ only by sigil, so a call site doesn't show which guarantee it gives. This was a review follow-up on #8465.In this patch the
macro_rules!macro isjsg_traced_unchecked!, so each call site says that it skips the field check. The test structs in jsg-test whose fields are plain data move to#[jsg_traced]. The ones that stay unchecked are the twoDropCounters, which hold a&'static AtomicUsize, and theConversionenum. The docs name#[jsg_traced]first. Nothing changes at runtime.