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

Use feature() on nightly toolchains only. #534

Merged
merged 1 commit into from
Nov 28, 2023

Conversation

Dirbaio
Copy link
Member

@Dirbaio Dirbaio commented Nov 28, 2023

feature() is only allowed on Nightly, it's completely disallowed on stable and beta
even for already-stabilized features. So, we autodetect whether the user is using nightly
and conditionally use feature(). This allows the crates to Just Work on current 1.75 beta
and will also Just Work when 1.75 stable is out.

Keeping feature() is desirable to keep support for:

  • Espressif's xtensa rustc fork. (they build from the stable branch but enable use of feature(), so latest xtensa rustc still requires feature())
  • Users of older nightlies

Once xtensa rust 1.75 is out, we can remove this (upstream nightlies that require feature() will be quite old by then, so dropping support for them should be OK).

I decided to not use already-made crates like rustversion to do this because they're quite big and do way more than what we need, so I felt badd adding another dep. The code is inspired from rustversion's build.rs.

@Dirbaio Dirbaio requested a review from a team as a code owner November 28, 2023 18:41
`feature()` is only allowed on Nightly, it's completely disallowed on stable and beta
even for already-stabilized features. So, we autodetect whether the user is using nightly
and conditionally use `feature()`. This allows the crates to Just Work on current 1.75 beta
and will also Just Work when 1.75 stable is out.

Keeping `feature()` is desirable to keep support for:

- Espressif's xtensa rustc fork. (they build from the stable branch but enable use of `feature()`, so latest xtensa rustc still requires `feature()`)
- Users of older nightlies

Once xtensa rust 1.75 is out, we can remove this (upstream nightlies that require `feature()` will be quite old by then, so dropping support for them should be OK).

I decided to not use already-made crates like `rustversion` to do this because they're quite big and do way more than what we need, so I felt badd adding another dep. The code is inspired from `rustversion`'s build.rs.
Copy link
Member

@MabezDev MabezDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for thinking of Xtensa too 😊, LGTM!

@Dirbaio Dirbaio added this pull request to the merge queue Nov 28, 2023
Merged via the queue into rust-embedded:master with commit 9e939bb Nov 28, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants