#17472·cargo

Preserve feature metadata in packaged Cargo.toml

Author: weihangloCreated Sep 14, 2026Updated Sep 16, 2026
LabelsC-bugA-featuresS-triageZ-feature-metadata

Problem

The implementation of feature metadata in https://github.com/rust-lang/cargo/pull/15056 currently normalizes the metadata table to an array of enabled features, which is a lossy normoralization.

  • cargo info and cargo metadata cannot retrieve the information for registry dependencies.
  • package.rust-version may drift from registry dependencies and the git repo if people want to patch. The latter will require higher MSRV supporting the new syntax.

See https://github.com/rust-lang/cargo/issues/14157#issuecomment-5594488074

Steps

No response

Possible Solution(s)

The published manifest generated by cargo package/cargo publish should contain whatever new metadata fields written in the original Cargo.toml. We may want to additionally check whether package.rust-version is compatible if those fields are present.

Notes

No response

Version

cc5596f058e623d22be718adf541a9bd766d9417