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.
Summary
suggest_fix_for_errorcounts raw{and}characters insource_codewhen rustc reports an unclosed delimiter. This includes braces inside string literals, which produces misleading brace-balance suggestions.Reproducer
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-564Notes
This is only diagnostic text, but it points users in the wrong direction during syntax debugging.