Conversation
89d6e2b to
01bc9ec
Compare
This comment has been minimized.
This comment has been minimized.
|
The generated output of |
f30d328 to
0fc6fee
Compare
jasnell
reviewed
Oct 27, 2025
f463539 to
440508a
Compare
jasnell
reviewed
Nov 6, 2025
7be536c to
e218b33
Compare
f33addc to
3f458ba
Compare
3f458ba to
1527967
Compare
jasnell
reviewed
Nov 18, 2025
jasnell
reviewed
Nov 18, 2025
jasnell
reviewed
Nov 18, 2025
f636b19 to
42435db
Compare
20579ac to
31942b8
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces comprehensive Rust bindings for the JSG (JavaScript Glue) system, enabling Rust code to interact with V8 and implement JavaScript APIs. The implementation provides type-safe V8 integration with support for wrapping/unwrapping Rust resources, procedural macros for reducing boilerplate, and a test harness with proper Realm initialization.
Key Changes:
- Added core Rust JSG bindings (
jsgcrate) with V8 handle types (Local/Global), FFI bridges, and resource management - Implemented procedural macros (
jsg-macros) for#[jsg_struct],#[jsg_resource], and#[jsg_method]to reduce boilerplate - Created test infrastructure (
jsg-test) with proper V8 context setup for testing Rust JSG bindings - Integrated Rust-backed Node.js DNS implementation as a demonstration, conditionally enabled via autogate
- Added Realm tracking for deterministic cleanup of Rust resources when V8 contexts are disposed
Reviewed changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 16 comments.
Show a summary per file
| File | Description |
|---|---|
src/workerd/util/autogate.h |
Added RUST_BACKED_NODE_DNS autogate key for feature flagging |
src/workerd/util/autogate.c++ |
Registered the new autogate key with its string representation |
src/workerd/jsg/wrappable.h |
Added RUST_REALM context slot and WORKERD_RUST_WRAPPABLE_TAG for Rust resources |
src/workerd/jsg/setup.h |
Exposed getIsolate() method for Rust FFI access to V8 isolate |
src/workerd/jsg/BUILD.bazel |
Added Rust JSG dependency and visibility for Rust packages |
src/workerd/io/worker.c++ |
Integrated Realm creation/disposal in context lifecycle |
src/workerd/api/rtti.c++ |
Added stub addBuiltinModule overload for future module registration |
src/workerd/api/node/node.h |
Conditionally registers C++ or Rust DNS implementation based on autogate |
src/workerd/api/node/BUILD.bazel |
Added Rust API dependency |
src/rust/jsg/v8.rs |
Core V8 FFI bindings with Local/Global handles and type conversions |
src/rust/jsg/modules.rs |
Module registration interface for Rust modules |
src/rust/jsg/lib.rs |
Core JSG types: Lock, Ref, Resource/Struct traits, Realm, and resource lifecycle |
src/rust/jsg/jsg.h |
C++ wrapper for Rust module registry integration |
src/rust/jsg/ffi.h |
FFI function declarations for V8 operations |
src/rust/jsg/ffi.c++ |
FFI function implementations bridging Rust and V8 C++ APIs |
src/rust/jsg/ffi-inl.h |
Template implementations for FFI type conversions |
src/rust/jsg/BUILD.bazel |
Build configuration for JSG Rust crate and FFI library |
src/rust/jsg-test/lib.rs |
Test harness and comprehensive integration tests for JSG bindings |
src/rust/jsg-test/ffi.h |
Test harness interface declarations |
src/rust/jsg-test/ffi.c++ |
Test harness implementation with V8 context setup |
src/rust/jsg-test/BUILD.bazel |
Build configuration for test infrastructure |
src/rust/jsg-macros/lib.rs |
Procedural macros for struct/resource/method code generation |
src/rust/jsg-macros/README.md |
Documentation for macro usage patterns |
src/rust/jsg-macros/BUILD.bazel |
Build configuration for proc macro crate |
src/rust/dns/lib.rs |
Added note about temporary duplication during migration |
src/rust/api/lib.rs |
Module registration entry point for Rust Node.js APIs |
src/rust/api/dns.rs |
Rust implementation of DNS utility with CAA/NAPTR record parsing |
src/rust/api/BUILD.bazel |
Build configuration for API crate |
patches/v8/0014-Add-another-slot-in-the-isolate-for-embedder.patch |
Increased V8 isolate data slots to accommodate Rust realm |
compile_flags.txt |
Added include paths for new Rust JSG modules |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mamonaminyar1998
referenced
this pull request
Nov 25, 2025
c42f082 to
efee4b3
Compare
npaun
reviewed
Nov 25, 2025
b4423e0 to
6537ca2
Compare
6537ca2 to
6cc580c
Compare
eed4176 to
473a0a0
Compare
guybedford
reviewed
Nov 26, 2025
10e6142 to
cf9be8b
Compare
cf9be8b to
1469fef
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Rust JSG bindings and comprehensive test coverage
This PR introduces Rust bindings for JSG, enabling
Rust code to interact with V8 and implement JavaScript APIs.
Key changes:
The Rust JSG implementation provides type-safe V8 integration and will
enable more Rust-based APIs in workerd.
Example usage: