Skip to content

Bug: suggest_fix_for_error counts braces inside string literals #235

@terasakisatoshi

Description

@terasakisatoshi

Summary

suggest_fix_for_error counts raw { and } characters in source_code when rustc reports an unclosed delimiter. This includes braces inside string literals, which produces misleading brace-balance suggestions.

Reproducer

using RustCall

stderr = "error: unclosed delimiter"
source = "fn foo() { let s = \"{\"; }"

RustCall.suggest_fix_for_error(stderr, source)

Actual output includes:

[
    "Mismatched braces. Check that all opening `{` have matching closing `}`.",
    "Found 1 more opening brace(s) than closing brace(s).",
]

Expected

The brace-count hint should ignore braces inside string literals and should not report an extra opening brace for this source.

Affected Code

  • src/exceptions.jl:556-564

Notes

This is only diagnostic text, but it points users in the wrong direction during syntax debugging.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions