Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure let stmt compound assignment removal suggestion respect codepoint boundaries #128865

Merged
merged 2 commits into from
Aug 9, 2024

Commits on Aug 9, 2024

  1. tests: add regression test for rust-lang#128845

    For codepoint boundary assertion triggered by a let stmt compound
    assignment removal suggestion when encountering recovered multi-byte
    compound ops.
    
    Issue: <rust-lang#128845>
    jieyouxu committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    92520a9 View commit details
    Browse the repository at this point in the history
  2. parser: ensure let stmt compound assignment removal suggestion respec…

    …t codepoint boundaries
    
    Previously we would try to issue a suggestion for `let x <op>= 1`, i.e.
    a compound assignment within a `let` binding, to remove the `<op>`. The
    suggestion code unfortunately incorrectly assumed that the `<op>` is an
    exactly-1-byte ASCII character, but this assumption is incorrect because
    we also recover Unicode-confusables like `➖=` as `-=`. In this example,
    the suggestion code used a `+ BytePos(1)` to calculate the span of the
    `<op>` codepoint that looks like `-` but the mult-byte Unicode
    look-alike would cause the suggested removal span to be inside a
    multi-byte codepoint boundary, triggering a codepoint boundary
    assertion.
    
    Issue: <rust-lang#128845>
    jieyouxu committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    d65f131 View commit details
    Browse the repository at this point in the history