Skip to content

Rust JSG: rename jsg_traced! to jsg_traced_unchecked! - #8518

Merged
littledivy merged 1 commit into
mainfrom
littledivy/2026-11-17-rjsg-traced-unchecked
Nov 17, 2026
Merged

littledivy merged 1 commit into
mainfrom
littledivy/2026-11-17-rjsg-traced-unchecked

Conversation

@littledivy

Copy link
Copy Markdown
Member

#[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. This was a review follow-up on #8465.

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.

#[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.
@littledivy
littledivy requested review from a team as code owners November 17, 2026 05:49

@clanky-the-clanker clanky-the-clanker Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 guybedford left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/rust/jsg-test/tests/function_new.rs Resolved
@littledivy
littledivy merged commit e364039 into main Nov 17, 2026
23 checks passed
@littledivy
littledivy deleted the littledivy/2026-11-17-rjsg-traced-unchecked branch November 17, 2026 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants