Skip to content

Preserve raw-string contents when detecting Rust function boundaries #889

Closed

Description

@LunaStev

Problem

The scanner handles every quote as a normal-string delimiter and has no raw-string hash state. An embedded quote in a valid raw string ends string state too early and exposes text/braces as Rust syntax.

Reproduction

Executed the helper at fd07427f4a976de05e38eff3ee1760db97fbb761 using importlib and add_function_spacing on:

fn first() {
    let s = r#"hello " { }
fn fake() {}
"#;
}
fn second() {}

The result is unchanged; the intended separating blank line is missing. Starting point: tools/format-rust.py.

Scope

Recognize raw/byte-raw delimiters across lines, including hash counts. Function-like text inside strings must never affect spacing or literal bytes. Difficulty: medium.

Completion criteria

  • Handle embedded quotes/braces and multiline raw strings.
  • Preserve raw-string bytes exactly.
  • Retain nested-comment handling and idempotence.

Activity

  1. added
    bug
    good first issue
    on Oct 7, 2026
  2. tecnolgd commented on Oct 16, 2026

    @tecnolgd
    Contributor

    Hey @LunaStev , I'd like to work on this issue. Could you please assign it to me?

  3. LunaStev commented on Oct 16, 2026

    @LunaStev
    MemberAuthor

    3. Hey @LunaStev , I'd like to work on this issue. Could you please assign it to me?

    Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

buggood first issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions