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

Make package.name optional #12689

Open
epage opened this issue Sep 18, 2023 · 2 comments
Open

Make package.name optional #12689

epage opened this issue Sep 18, 2023 · 2 comments
Labels
A-manifest Area: Cargo.toml issues C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-team-input Status: Needs input from team on whether/how to proceed.

Comments

@epage
Copy link
Contributor

epage commented Sep 18, 2023

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.

@epage epage added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` A-manifest Area: Cargo.toml issues S-triage Status: This issue is waiting on initial triage. S-needs-team-input Status: Needs input from team on whether/how to proceed. labels Sep 18, 2023
@est31
Copy link
Member

est31 commented Sep 19, 2023

I'm not sure we'd be able to reduce documentation much here, as the logic to take the filename would not be suiting for Cargo.toml, so we'd have to document that differing logic. We would be able to reduce the overhead of writing existing Cargo.toml files though, which would be a benefit. I'd propose taking the name of the directory the Cargo.toml file is inside.

@epage
Copy link
Contributor Author

epage commented Sep 19, 2023

Oops, forgot to specify the parent directory.

While that technically is still a difference, the general concept is the same which makes it easier to teach.

@ehuss ehuss removed the S-triage Status: This issue is waiting on initial triage. label Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-manifest Area: Cargo.toml issues C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-team-input Status: Needs input from team on whether/how to proceed.
Projects
None yet
Development

No branches or pull requests

3 participants