Skip to content

chore(rust): bump toolchain to 1.93.0#2147

Merged
gaoachao merged 1 commit intolynx-family:mainfrom
colinaaa:chore/rust-1.93.0
Jan 27, 2026
Merged

chore(rust): bump toolchain to 1.93.0#2147
gaoachao merged 1 commit intolynx-family:mainfrom
colinaaa:chore/rust-1.93.0

Conversation

@colinaaa
Copy link
Collaborator

@colinaaa colinaaa commented Jan 27, 2026

Also fix clippy warnings and refresh generated web-core-wasm .d.ts outputs.

Summary by CodeRabbit

  • Refactor

    • Improved code safety patterns across transform plugins with enhanced error handling and reduced potential panic risks.
    • Reorganized internal WebAssembly platform APIs for style data, element templates, and event handling to better support current architecture.
  • Chores

    • Updated Rust toolchain to version 1.93.0 for improved compiler capabilities and performance.

✏️ Tip: You can customize this high-level summary in your review settings.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).
  • Changeset added, and when a BREAKING CHANGE occurs, it needs to be clearly marked (or not required).

Also fix clippy warnings and refresh generated web-core-wasm .d.ts outputs.
@changeset-bot
Copy link

changeset-bot bot commented Jan 27, 2026

⚠️ No Changeset found

Latest commit: 4191d68

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 27, 2026

📝 Walkthrough

Walkthrough

The pull request combines Rust code refactoring across multiple SWC plugin crates to eliminate unsafe unwrap() patterns in favor of safer pattern matching, alongside extensive reorganization of WebAssembly bindings and TypeScript type declarations for the web-core-wasm package, plus a Rust toolchain upgrade from 1.88.0 to 1.93.0.

Changes

Cohort / File(s) Summary
Rust SWC Plugin Refactoring (Unwrap Elimination)
packages/react/transform/crates/swc_plugin_compat/lib.rs, swc_plugin_css_scope/lib.rs, swc_plugin_inject/napi.rs, swc_plugin_snapshot/lib.rs, swc_plugin_worklet/decl_collect.rs, swc_plugin_worklet/extract_ident.rs
Replaces is_ok()/is_some() checks followed by unwrap() with pattern matching (if let Ok(v), if let Some(v)) and dereferencing patterns. Changes allocation patterns for AST node mutations while maintaining functional equivalence. Reduces panic risk and improves code safety.
WASM Bindings Type Definitions (Client)
packages/web-platform/web-core-wasm/binary/client/client.d.ts, client_bg.wasm.d.ts, client_debug.d.ts, client_debug_bg.wasm.d.ts
Extensive API surface reorganization: removes legacy component/config getter functions (e.g., mainthreadwasmcontext___GetComponentID, ___SetConfig), introduces new style/decode helpers (decodedstyledata_*), adds granular event info accessors (__wbg_get_eventinfo_*), and new inline style/dataset operations. Shifts from monolithic getters to event-driven, resource-managed API patterns.
WASM Bindings Type Definitions (Encode)
packages/web-platform/web-core-wasm/binary/encode/encode_bg.wasm.d.ts, encode_debug_bg.wasm.d.ts
Adds new raw element template APIs (rawelementtemplate_*), decoded style data bindings (decodedstyledata_*), and free/cleanup functions. Reorganizes public API surface to expose element creation/manipulation and style decoding/encoding utilities.
Toolchain
rust-toolchain.toml
Updates Rust toolchain version from 1.88.0 to 1.93.0, maintaining existing targets and profile settings.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

The SWC plugin changes are homogeneous and straightforward, but the WASM bindings reorganization across six files involves extensive public API surface changes, function signature modifications, and requires careful verification of backward compatibility and wasm-bindgen conventions.

Possibly related PRs

Suggested labels

platform:Web, framework:React

Suggested reviewers

  • PupilTong
  • gaoachao

Poem

🐰 Safe patterns replace the unwrap with care,
WASM bindings dance through the air,
New decoders and events align,
Rust 1.93 shines so fine,
Hopping onward, bugs beware! 🚀

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: bumping the Rust toolchain version from 1.88.0 to 1.93.0, which is reflected in the rust-toolchain.toml file changes and aligns with the PR's primary objective.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/react/transform/crates/swc_plugin_inject/napi.rs (1)

31-44: Guard against short arrays to avoid panics.

Indexing v[1] / v[2] can panic on malformed input, which is possible across the N-API boundary. Validate v.len() per variant and return InvalidArg when insufficient data is provided.

🛠️ Suggested fix
-    if let Ok(v) = array_val {
-      return match v[0].as_str() {
-        "expr" => Ok(InjectAs::Expr(v[1].clone())),
-        "importDefault" => Ok(InjectAs::ImportDefault(v[1].clone())),
-        "importStarAs" => Ok(InjectAs::ImportStarAs(v[1].clone())),
-        "importNamed" => Ok(InjectAs::ImportNamed(v[1].clone(), v[2].clone())),
+    if let Ok(v) = array_val {
+      let err = || {
+        Err(napi::bindgen_prelude::error!(
+          napi::bindgen_prelude::Status::InvalidArg,
+          "value does not match any variant of enum `{}`",
+          "InjectAs"
+        ))
+      };
+      if v.is_empty() {
+        return err();
+      }
+      return match v[0].as_str() {
+        "expr" if v.len() >= 2 => Ok(InjectAs::Expr(v[1].clone())),
+        "importDefault" if v.len() >= 2 => Ok(InjectAs::ImportDefault(v[1].clone())),
+        "importStarAs" if v.len() >= 2 => Ok(InjectAs::ImportStarAs(v[1].clone())),
+        "importNamed" if v.len() >= 3 => Ok(InjectAs::ImportNamed(v[1].clone(), v[2].clone())),
 
-        _ => Err(napi::bindgen_prelude::error!(
-          napi::bindgen_prelude::Status::InvalidArg,
-          "value does not match any variant of enum `{}`",
-          "InjectAs"
-        )),
+        _ => err(),
       };
     }

@codecov
Copy link

codecov bot commented Jan 27, 2026

Codecov Report

❌ Patch coverage is 94.44444% with 1 line in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...s/react/transform/crates/swc_plugin_inject/napi.rs 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 27, 2026

Merging this PR will not alter performance

✅ 63 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing colinaaa:chore/rust-1.93.0 (4191d68) with main (43fc7e7)

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@relativeci
Copy link

relativeci bot commented Jan 27, 2026

Web Explorer

#7382 Bundle Size — 382.04KiB (-0.7%).

4191d68(current) vs 43fc7e7 main#7379(baseline)

Bundle metrics  Change 1 change
                 Current
#7382
     Baseline
#7379
No change  Initial JS 154.71KiB 154.71KiB
No change  Initial CSS 35.05KiB 35.05KiB
Change  Cache Invalidation 0% 40.14%
No change  Chunks 8 8
No change  Assets 8 8
No change  Modules 238 238
No change  Duplicate Modules 16 16
Change  Duplicate Code 3%(+0.33%) 2.99%
No change  Packages 4 4
No change  Duplicate Packages 0 0
Bundle size by type  Change 1 change Improvement 1 improvement
                 Current
#7382
     Baseline
#7379
No change  JS 252.66KiB 252.66KiB
Improvement  Other 94.33KiB (-2.78%) 97.02KiB
No change  CSS 35.05KiB 35.05KiB

Bundle analysis reportBranch colinaaa:chore/rust-1.93.0Project dashboard


Generated by RelativeCIDocumentationReport issue

@gaoachao gaoachao merged commit 8002508 into lynx-family:main Jan 27, 2026
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants