Skip to content

[Bug]: Native Magic String index issues with UTF-16 characters #8685

@jorddn

Description

@jorddn

Reproduction link or steps

Repro here

What is expected?

.slice should return "string" and then be removed from the output using .remove.

What is actually happening?

Rolldown crashes and fails to remove or index the string properly.

Rolldown panicked. This is a bug in Rolldown, not your code.

thread '<unnamed>' (2) panicked at crates/string_wizard/src/magic_string/slice.rs:76:31:
byte index 17 is not a char boundary; it is inside '\u{fe0f}' (bytes 15..18) of `some 🤷‍♂️ string`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

System Info

System:
    OS: macOS 26.2
    CPU: (10) arm64 Apple M4
    Memory: 2.17 GB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.13.0 - /Users/jordan/.local/state/fnm_multishells/18650_1773481082557/bin/node
    npm: 11.6.2 - /Users/jordan/.local/state/fnm_multishells/18650_1773481082557/bin/npm
    bun: 1.3.10 - /opt/homebrew/bin/bun
    Deno: 2.7.5 - /opt/homebrew/bin/deno
  Browsers:
    Safari: 26.2
  npmPackages:
    rolldown: ^1.0.0-rc.9 => 1.0.0-rc.9

Any additional comments?

This issue also seems to apply to other (if not all) index-based methods such as .overwrite

Metadata

Metadata

Labels

No labels
No labels

Type

Priority

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions