Skip to content

Improve the diagnostics in virual workspaces #13965

Open
@VorpalBlade

Description

@VorpalBlade

Problem

I tried to add the following to my virtual workspace:

[lints.rust]
rust-2018-idioms = "warn"

This results in the following diagnostic:

cargo check
error: failed to parse manifest at `/home/user/src/project/Cargo.toml`

Caused by:
  this virtual manifest specifies a `lints` section, which is not allowed

That diagnostic doesn't give a hint about that the solution is to rename the table to workspace.lints.rust. And googling the error did not turn up very useful results either.

Proposed Solution

cargo check
error: failed to parse manifest at `/home/user/src/project/Cargo.toml`

Caused by:
  this virtual manifest specifies a `lints` section, which is not allowed
Suggestion:
  For workspaces, use `workspace.lints` instead

Note the added suggestion. Rustc is usually very good about giving useful hints. I assume Cargo should be able to do so too.

There is a question about what to do when you have a non-virtual workspace. It is not a feature I use myself, so I have no input on the diagnostic in that case.

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Error and warning messages generated by Cargo itself.A-workspacesArea: workspacesC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions