Make package.name optional (original) (raw)

Problem

The primary motivation for this is to close the gap between Cargo.toml and the cargo script experiment (#12207).

For Cargo.toml, package.name is required

For "cargo script", package.name is defaulted to a slug of the file stem.

Proposed Solution

Like with #9829, making this field optional would reduce the specialized documentation around "cargo script". The default for Cargo.toml would be a slug of the parent directory.

Notes

I think there are some other concrete cases that could potentially benefit from this, like rust-lang/rfcs#3452 though I overall see this rarely being relied upon.