Skip to content

fix: prevent EOF diagnostic panic without trailing newline - #379

Merged
aspizu merged 1 commit into
mainfrom
apz/fix-eof-diagnostic
Sep 9, 2026
Merged

fix: prevent EOF diagnostic panic without trailing newline#379
aspizu merged 1 commit into
mainfrom
apz/fix-eof-diagnostic

Conversation

@aspizu

@aspizu aspizu commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Files ending in an incomplete statement without a trailing newline, such as var myvar, panic while rendering the EOF diagnostic. Translation units append a synthetic newline, but the diagnostic renderer previously read the shorter original source.

Apply the same trailing-newline normalization to diagnostic snippets so the error span remains in bounds. The source file is unchanged. This also handles included files and missing-include diagnostics without a final newline.

Validated on macOS with 13 CLI cases, including both reported reproducers, included files, CRLF, Unicode strings, and valid input. Both reproducers now report an EOF error and exit with code 1. All 12 existing tests and cargo check --offline pass. CLI checks used std = "0.0.0" to avoid unrelated network initialization.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-08T20:01:47.698443Z 89ffb20 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@aspizu
aspizu merged commit 361a8ca into main Sep 9, 2026
1 check passed
@aspizu
aspizu deleted the apz/fix-eof-diagnostic branch September 9, 2026 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant