Skip to content

Cargo dignostic for misplaced cargo-features = ["edition2021"] could be better #9717

@Craig-Macomber

Description

@Craig-Macomber

I followed the process at https://blog.rust-lang.org/2021/07/21/Rust-2021-public-testing.html#public-testing-period and wish to report a quality issue with a diagnostic from Cargo. The issue template linked didn't have one for cargo diagnostics, so I'm using the rustc diagnostic template.

Given the following code:

[package]
name = "x"
version = "0.1.0"
authors = ["..."]
edition = "2021"
cargo-features = ["edition2021"]

The current output is:

$ cargo +nightly check
error: failed to parse manifest at `/home/craig/Scratch/rusty-flame/Cargo.toml`

Caused by:
  cargo-features = ["edition2021"] was found in the wrong location, it should be set at the top of Cargo.toml before any tables

Ideally the output should look like:

$ cargo +nightly check
error: failed to parse manifest at `/home/craig/Scratch/rusty-flame/Cargo.toml`

Caused by:
  cargo-features = ["edition2021"] was found in the wrong location: it should be set at the top of Cargo.toml before any sections.

The error is message is grammatically two sentences, which are comma spliced. They should have a period or a colon instead. Additionally the trailing period is missing, and https://doc.rust-lang.org/cargo/reference/manifest.html refers to the units within a toml file as "sections" not tables.

$ rustc +nightly --version --verbose
rustc 1.55.0-nightly (027187094 2021-07-22)
binary: rustc
commit-hash: 027187094ee05011d6602f5742f550851ccc7fd6
commit-date: 2021-07-22
host: x86_64-unknown-linux-gnu
release: 1.55.0-nightly
LLVM version: 12.0.1

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions