[pull] main from react:main#511
Merged
Merged
Conversation
…36852) ## Summary `formatConsoleArguments` (used by the DevTools backend to inline console substitutions) walks the format string and inlines `%s`/`%d`/`%i`/`%f` arguments while leaving `%c`/`%o`/`%O` in place. For each `%` it reads the **next** character to decide what to do. When the format string ends with a lone `%` — e.g. `console.log('Progress 100%', value)` — the character after `%` is `undefined`, and the `default` branch ran: ```js template += `%${nextChar}`; // -> "%undefined" ``` So the function emitted the literal text `%undefined`: ```js formatConsoleArguments('Progress 100%', 'extra'); // before: ['Progress 100%undefined', 'extra'] // after: ['Progress 100%', 'extra'] ``` Browsers render a trailing `%` in a console format string as a literal percent sign, so this PR keeps it as `%` when there is no following character. ## How did you test this change? Added a `keeps a trailing percent sign` test to the existing `formatConsoleArguments` suite in `utils-test.js` (covering both a bare trailing `%` and one that follows another substitution). Since the function is pure and import-free, I also verified the patched logic against every existing case in that suite plus the new ones to confirm there are no regressions.
Swaps the default hashers across the Rust compiler crates for rustc-hash's faster `FxHasher`. ## Why `FxHasher` is a simple, fast, non-cryptographic hasher. std's default (SipHash) is DoS-resistant but heavy — the compiler keys maps/sets almost entirely on small integer IDs (`IdentifierId`, `BlockId`, `ScopeId`, …) where that protection buys nothing. Switching gives: - **Performance** — faster hashing on the hot ID-keyed maps/sets used throughout the passes. - **Slight binary size reduction** — drops the heavy SipHash hasher pulled in by std's `HashMap`/`HashSet`. ## Changes - `std::collections::HashMap`/`HashSet` → `rustc_hash::FxHashMap`/`FxHashSet` - `indexmap` `IndexMap`/`IndexSet` now use `FxBuildHasher`, inlined as `IndexMap<K, V, FxBuildHasher>` (no `FxIndexMap` type aliases) - `rustc-hash = "2"` added to all 12 crate manifests - `rustc_hash`/`indexmap` imports consolidated into single brace imports at the top of each file The change is serde-neutral: `FxHashMap` and `IndexMap<_, _, FxBuildHasher>` serialize to byte-identical JSON, and `IndexMap` keeps insertion order. `cargo check`, `cargo fmt --check`, and `cargo test` all pass with no warnings.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )