uv
99a032a4 - netrc/lex: fix `lineno` not incremented in `read_line` (#19452)

Commit
62 days ago
netrc/lex: fix `lineno` not incremented in `read_line` (#19452) ## Summary `Lex::read_line` iterates directly over `self.instream` instead of going through `self.read_char`, which is the only place that increments `self.lineno`. As a result, every newline consumed by `read_line` is invisible to the line counter, causing parse errors reported after any `macdef` block or bare-`#` comment to show an incorrect (too-low) line number. The fix is a one-line change: replace the `for ch in &mut self.instream` loop with `while let Some(ch) = self.read_char()`. The parsed output is identical; only the line-number bookkeeping is corrected. The three call sites affected are: - Discarding a bare `#` comment line in the top-level token loop - Reading each line of a `macdef` macro body - Discarding a bare `#` comment line in the follower-token loop ## Test Plan Existing tests in `crates/uv-netrc/src/netrc.rs` continue to pass. The bug manifests only in error-message line numbers, so no behavioural test was previously catching it. A targeted regression test can be added if the maintainers prefer — happy to include one on request.
Author
Parents
Loading