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

Cargo should tell build.rs what the Rust edition is #6408

Open
vandenoever opened this issue Dec 9, 2018 · 3 comments
Open

Cargo should tell build.rs what the Rust edition is #6408

vandenoever opened this issue Dec 9, 2018 · 3 comments
Labels
A-build-scripts Area: build.rs scripts A-editions Area: edition-specific issues C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

Comments

@vandenoever
Copy link

Describe the problem you are trying to solve
Syntax between Rust 2015 and Rust 2018 is different. Generating code in build.rs should know what edition of Rust to generate code for.
The code could parse Cargo.toml to figure this out, but it's cumbersome.

Describe the solution you'd like
An environment variable e.g. RUST_EDITION=2018 would help.

@alexcrichton alexcrichton added A-build-scripts Area: build.rs scripts C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` labels Dec 10, 2018
@ehuss
Copy link
Contributor

ehuss commented Dec 18, 2018

This may be complicated by the fact that targets within a package can be in different editions. I imagine just including the package edition would cover 99.9% of the situations, but there should be at least a note in the documentation about this potential pitfall.

@ehuss
Copy link
Contributor

ehuss commented Dec 18, 2018

@ehuss ehuss added the A-editions Area: edition-specific issues label Apr 6, 2020
@epage epage added the S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted. label Oct 25, 2023
@epage
Copy link
Contributor

epage commented Oct 25, 2023

This may be complicated by the fact that targets within a package can be in different editions.

I had to go look at the docs because I found this so surprising.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-build-scripts Area: build.rs scripts A-editions Area: edition-specific issues C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
Projects
None yet
Development

No branches or pull requests

4 participants