-
Notifications
You must be signed in to change notification settings - Fork 2.7k
fix(manifest): Report script manifest errors for the right line number #15927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This will make error reporting easier as well as editing
r? @weihanglo rustbot has assigned @weihanglo. Use |
931db7e
to
8fdd695
Compare
4898269
to
44389cb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Feel free to address nits or merge it :)
44389cb
to
4bec4f1
Compare
4bec4f1
to
0603e4e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the comment updates!
Update cargo submodule 10 commits in 761c4658d0079d607e6d33cf0c060e61a617cad3..98402ac7a41dd0f564d3e56d58180d325d0417a0 2025-09-04 01:25:01 +0000 to 2025-09-09 20:19:39 +0000 - fix(flock): check if they are marked unsupported in libstd (rust-lang/cargo#15941) - test(manifest): Fix test output order (rust-lang/cargo#15940) - refactor(shell): Simplify some code (rust-lang/cargo#15937) - fix(manifest): Report script manifest errors for the right line number (rust-lang/cargo#15927) - refactor: replace flock with std flock (rust-lang/cargo#15935) - fix(cli): Adjust messages to match rustc (rust-lang/cargo#15928) - fix: Switch from --nocapture to --no-capture (rust-lang/cargo#15930) - Render individual compilation sections in `--timings` pipeline graph (rust-lang/cargo#15923) - test(credential): Switch more expected results to snapshots (rust-lang/cargo#15929) - refactor(cli): Pull out error chain iteration (rust-lang/cargo#15926) r? ghost
Update cargo submodule 13 commits in 761c4658d0079d607e6d33cf0c060e61a617cad3..24bb93c388fb8c211a37986539f24a819dc669d3 2025-09-04 01:25:01 +0000 to 2025-09-10 23:16:07 +0000 - Bump miow to 0.60.1 (rust-lang/cargo#15950) - test(help): Ensure consistent behavior regardless of rustup use (rust-lang/cargo#15949) - docs(changelog): Clarify how manifest paths are used (rust-lang/cargo#15946) - fix(flock): check if they are marked unsupported in libstd (rust-lang/cargo#15941) - test(manifest): Fix test output order (rust-lang/cargo#15940) - refactor(shell): Simplify some code (rust-lang/cargo#15937) - fix(manifest): Report script manifest errors for the right line number (rust-lang/cargo#15927) - refactor: replace flock with std flock (rust-lang/cargo#15935) - fix(cli): Adjust messages to match rustc (rust-lang/cargo#15928) - fix: Switch from --nocapture to --no-capture (rust-lang/cargo#15930) - Render individual compilation sections in `--timings` pipeline graph (rust-lang/cargo#15923) - test(credential): Switch more expected results to snapshots (rust-lang/cargo#15929) - refactor(cli): Pull out error chain iteration (rust-lang/cargo#15926)
Update cargo submodule 13 commits in 761c4658d0079d607e6d33cf0c060e61a617cad3..24bb93c388fb8c211a37986539f24a819dc669d3 2025-09-04 01:25:01 +0000 to 2025-09-10 23:16:07 +0000 - Bump miow to 0.60.1 (rust-lang/cargo#15950) - test(help): Ensure consistent behavior regardless of rustup use (rust-lang/cargo#15949) - docs(changelog): Clarify how manifest paths are used (rust-lang/cargo#15946) - fix(flock): check if they are marked unsupported in libstd (rust-lang/cargo#15941) - test(manifest): Fix test output order (rust-lang/cargo#15940) - refactor(shell): Simplify some code (rust-lang/cargo#15937) - fix(manifest): Report script manifest errors for the right line number (rust-lang/cargo#15927) - refactor: replace flock with std flock (rust-lang/cargo#15935) - fix(cli): Adjust messages to match rustc (rust-lang/cargo#15928) - fix: Switch from --nocapture to --no-capture (rust-lang/cargo#15930) - Render individual compilation sections in `--timings` pipeline graph (rust-lang/cargo#15923) - test(credential): Switch more expected results to snapshots (rust-lang/cargo#15929) - refactor(cli): Pull out error chain iteration (rust-lang/cargo#15926)
What does this PR try to resolve?
Currently, if you have a manifest parse error for a cargo script, the line number will be relative to the start of the frontmatter and not the source file. This changes it so we get the line number relative to the start of the source file.
How to test and review this PR?
Notes
To do this, I added span tracking to our frontmatter parser. To make this easier, I used some helpers from winnow which is an existing transitive dependency.
This span tracking will also come into use when I change the frontmatter parser to start reporting spans in errors so we get annotated snippets of source in the error messages to users.