Skip to content
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

Add line number to error messages about parsing Cargo.toml #12816

Closed
andresovela opened this issue Oct 12, 2023 · 1 comment
Closed

Add line number to error messages about parsing Cargo.toml #12816

andresovela opened this issue Oct 12, 2023 · 1 comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage.

Comments

@andresovela
Copy link

Problem

When there's a problem with Cargo.toml, cargo outputs an error but it does not mention where the error is coming from. For example:

$ cargo build
error: failed to parse manifest at `path/to/Cargo.toml`

Caused by:
  error inheriting `$crate` from workspace root manifest's `workspace.dependencies.$crate`

Caused by:
  failed to find a workspace root

Proposed Solution

It'd be nice if cargo mentioned which is the offending line in the manifest. For example:

$ cargo build
error: failed to parse manifest at `path/to/Cargo.toml:24`

Caused by:
$crate = { workspace = true } 

Caused by:
  error inheriting `$crate` from workspace root manifest's `workspace.dependencies.$crate`

Caused by:
  failed to find a workspace root

Notes

No response

@andresovela andresovela added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage. labels Oct 12, 2023
@epage
Copy link
Contributor

epage commented Oct 12, 2023

So with Rust 1.74, more errors will include span information (#12556).

We also have #12810 about adding span information. Closing in favor of that. If there is a reason to keep both open, let us know!

@epage epage closed this as not planned Won't fix, can't repro, duplicate, stale Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

2 participants