You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Rust: a parameter default containing /* (e.g. "src/**/*.rs") leaves the default-value comment unterminated, so rustc fails with E0758 #384
C, Go and Rust have no default arguments, so StandardLanguageGenerator.AppendDefaultValueComment (Coder/Languages/StandardLanguageGenerator.cs, around L1599-L1610) writes the default into a block comment: /* = <value> */. It breaks */ apart (Replace("*/", "* /")) so the comment cannot close early. That is enough for C and Go.
Rust block comments nest, though. A /* inside one opens a nested comment, and rustc does not recognise string literals inside comments. So a default whose spelling contains /* leaves the comment unterminated, and rustc rejects the whole file.
Breaking */ apart can itself create a /*: "src/**/*.rs" becomes "src/** /*.rs".
Repro
Take a FunctionDeclarationfind(pattern: string = "src/**/*.rs") -> int { return 1 }, with DefaultValue = new LiteralExpression<string>("src/**/*.rs") and IsOptional = true.
rustc (edition 2021) reports error[E0758]: unterminated block comment. A default of "/*" alone fails the same way. Glob and path defaults such as "**/*.cs" or "src/*" are realistic inputs. Go and C compile the same text, because their comments do not nest.
Suggested fix / acceptance criteria
In the Rust path, also break /* apart (for example / *), or let each generator override how the comment text is sanitised. A line comment is not an option here, because the default sits inside the parameter list.
Add Rust compile-test cases (alongside the existing real-toolchain tests) for a string default containing /* and one containing */.
Category: Bug. Rust's nested block comments make the default-value comment unterminated, so the whole generated file fails to compile (E0758).
Priority: Medium. One realistic input breaks the entire output file: glob or path defaults such as "**/*.cs". The fix is small: sanitise /* as well as */ for Rust, or let each generator override the sanitisation.
Area:Coder/Languages/StandardLanguageGenerator.cs (AppendDefaultValueComment) and the Rust generator, with Rust real-toolchain compile tests.
Activity
matt-edmondson commentedon Oct 30, 2026
Triage
"**/*.cs". The fix is small: sanitise/*as well as*/for Rust, or let each generator override the sanitisation.Coder/Languages/StandardLanguageGenerator.cs(AppendDefaultValueComment) and the Rust generator, with Rust real-toolchain compile tests.\u{{0007}}, which rustc rejects #382, Rust: a specialisation writes its nested types twice, the second copy insideimpl Trait for Type, so the output fails to compile (E0449) #370, Rust: reading a struct-typed file-scope field fails to compile (E0507 "cannot move out of static item") #354, Rust: a record holding a struct through an auto-property fails to compile (E0277), because the held struct never derives Clone/Debug/PartialEq #353) share the real-toolchain test harness. The comment-sanitising fix should probably also checkAppendDefaultValueCommentin the C and Go paths for consistency, even though they are unaffected.Generated by Claude Code
Merge main into the #397 branch