Update toolchain and remove nightly-only flags#13007
Conversation
There was a problem hiding this comment.
Pull request overview
This PR migrates the workspace toward a stable Rust toolchain by removing nightly-only flags/features and updating regex utilities and cacheable annotations to avoid relying on Pattern-based regex integration.
Changes:
- Switch toolchain from pinned nightly to stable and remove nightly-only
-Z*rustflags. - Drop
patternfeatures fromregex/regressand replacestr::split/match_indicesusages with iterator-based matching. - Adjust
#[cacheable]field annotations (notably for dyn trait fields) to preserve rkyv serialization behavior.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| rust-toolchain.toml | Switches toolchain channel to stable. |
| .cargo/config.toml | Removes nightly -Z rustflags; adds RUSTC_BOOTSTRAP=1. |
| Cargo.toml | Removes regress pattern feature from workspace deps. |
| crates/rspack_util/Cargo.toml | Removes regex pattern feature. |
| crates/rspack_util/src/identifier.rs | Replaces regex match_indices usage with find_iter. |
| crates/rspack_plugin_javascript/Cargo.toml | Removes regress pattern feature. |
| crates/rspack_plugin_javascript/src/parser_plugin/initialize_evaluating.rs | Reimplements regexp split using find_iter. |
| crates/rspack_core/src/module_graph/rollback/overlay_map.rs | Minor refactor to avoid expect on overlay access. |
| crates/rspack_core/src/dependencies_block.rs | Updates cacheable annotation to use AsCacheable for serialization. |
| crates/rspack_core/src/concatenated_module.rs | Adds AsCacheable annotation for code generation dependency trait objects. |
| crates/rspack_cacheable_test/tests/macro/cacheable_dyn.rs | Adds AsCacheable annotations for dyn fields in tests. |
| crates/rspack_cacheable_test/tests/macro/manual_cacheable_dyn.rs | Adds AsCacheable annotation for dyn field in tests. |
| crates/rspack_cacheable_test/tests/macro/manual_cacheable_dyn_with_generics.rs | Adds AsCacheable annotations for dyn fields in tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # workaround for getting workspace root dir, reference: https://github.com/rust-lang/cargo/issues/3946 | ||
| [env] | ||
| CARGO_WORKSPACE_DIR = { value = "", relative = true } | ||
| RUSTC_BOOTSTRAP = "1" |
There was a problem hiding this comment.
Setting RUSTC_BOOTSTRAP=1 effectively opts the entire workspace into unstable compiler behavior even on the stable toolchain. This undermines the stated goal of “maximum compatibility” (and can hide accidental nightly-only feature usage); prefer removing this and instead eliminating remaining #![feature(...)]/unstable usages or keeping a pinned nightly toolchain explicitly.
rust-toolchain.toml
Outdated
| # Use stable for maximum compatibility. | ||
| channel = "stable" |
There was a problem hiding this comment.
Switching to channel = "stable" removes the previously pinned toolchain version and can make builds/CI non-reproducible as the stable compiler advances. If reproducibility matters here (it previously did with a dated nightly), consider pinning to a specific stable release (e.g. stable-<version>) or documenting why tracking latest stable is acceptable.
| let regex = eval_regexp_to_regexp(&raw.0, &raw.1); | ||
| param.string().split(®ex).map(|s| s.to_owned()).collect() | ||
| let input = param.string(); | ||
| let mut result = Vec::new(); | ||
| let mut last = 0; | ||
| for matched in regex.find_iter(input) { |
There was a problem hiding this comment.
The regexp split behavior was reimplemented manually. Since this file already has unit tests, add coverage for .split(/.../) cases (e.g. matches at start/end, consecutive matches, and patterns that can match empty) to ensure behavior stays consistent with the previous str::split-via-Pattern implementation.
Summary
.splitTesting