feat(kernel): R7b Rust walker — rustlang module, tree-sitter-rust 0.24.2 bump, rust default-routed (#1371)

First R7b language port. Grammar: tree-sitter-rust pinned =0.24.2 + wasm
vendored from tag 77a3747 (parser.c/scanner.c sha-matched against the
crates.io tarball), replacing the 2023 ABI-14 tree-sitter-wasms build —
the bump alone is precision-positive on the wasm path (receiver-qualified
instance-method resolutions replace ambiguous bare-name matches; node
sections byte-identical on ripgrep/tokio).

Walker mirrors the TS reference bug-for-bug per
docs/design/rust-lang-kernel-port-checklist.md (survey artifact): dead-code
isAsync, impl-pushes-no-scope, the impl-Trait-for-Generic<T> trait-receiver
quirk, phantom const identifiers, use-binding triple emission,
wildcard-use-emits-nothing, scoped-supertrait drop, chained-call re-encode
gated on scoped_identifier, Rocket route macros body-only.

Gates: parity sweeps 0 diffs — ripgrep 101/101, tokio 790/790,
rust-analyzer 1217/1488 (271 deferrals are token-macro-table sources that
error on BOTH arms — grammar-inherent); full-init dump-diffs byte-identical
on all three (3,857 / 13,440 / 39,030 nodes); kernel-rustlang-parity suite
(torture + CRLF + defer) in npm test; full suite green x2 with
CODEGRAPH_KERNEL_EXPECT=1.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Colby Mchenry
2026-07-20 00:08:09 -05:00
committed by GitHub
co-authored by Claude Fable 5
parent ce0ae30e09
commit f1ca991943
15 changed files with 2380 additions and 7 deletions
+4 -2
View File
@@ -15,8 +15,8 @@ use tree_sitter::Language;
/// Languages this kernel binary can extract (reported by contractInfo;
/// TS-side routing policy decides what actually routes).
pub const LANGUAGES: [&str; 9] =
["typescript", "tsx", "javascript", "jsx", "java", "python", "go", "c", "cpp"];
pub const LANGUAGES: [&str; 10] =
["typescript", "tsx", "javascript", "jsx", "java", "python", "go", "c", "cpp", "rust"];
pub fn grammar_for(language: &str) -> Option<Language> {
match language {
@@ -31,6 +31,8 @@ pub fn grammar_for(language: &str) -> Option<Language> {
// TS-side — the route point applies preParse before the kernel call).
"c" => Some(tree_sitter_c::LANGUAGE.into()),
"cpp" => Some(tree_sitter_cpp::LANGUAGE.into()),
// R7b: v0.24.2, sha-matched with the vendored wasm (grammars.ts).
"rust" => Some(tree_sitter_rust::LANGUAGE.into()),
_ => None,
}
}
+2
View File
@@ -24,6 +24,7 @@ mod ids;
mod go;
mod java;
mod langs;
mod rustlang;
mod textutil;
mod python;
mod tsjs;
@@ -211,6 +212,7 @@ pub fn extract_file(file_path: String, content: String, language: String) -> Res
"python" => python::extract(&file_path, &content).map_err(Error::from_reason)?,
"go" => go::extract(&file_path, &content).map_err(Error::from_reason)?,
"c" | "cpp" => ccpp::extract(&file_path, &content, &language).map_err(Error::from_reason)?,
"rust" => rustlang::extract(&file_path, &content).map_err(Error::from_reason)?,
_ => tsjs::extract(&file_path, &content, &language).map_err(Error::from_reason)?,
};
Ok(ExtractBuffers {
File diff suppressed because it is too large Load Diff