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

Update to stabilized const_fn_trait_bound #325

Merged
merged 1 commit into from
Mar 16, 2022

Conversation

taiki-e
Copy link
Contributor

@taiki-e taiki-e commented Mar 10, 2022

const_fn_trait_bound has been stabilized on Rust 1.61 (currently nightly, nightly-2022-03-08+): rust-lang/rust#93827

This PR removes #![feature(const_fn_trait_bound)] and makes constructors for lock types const fn on Rust 1.61+ using autocfg.

(The first commit is from #327, and needed to fix CI failure)

Closes #299

@@ -0,0 +1,16 @@
fn main() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Adding a build script will make building a bit slower as the build script has to be compiled and the main crate has to wait on running the build script.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah. An alternative approach without such drawbacks is to use the options feature. If the maintainer prefers that approach, I'm happy to switch to using it.

Copy link
Owner

Choose a reason for hiding this comment

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

I personally don't mind this: the build script has no dependencies and can be compiled in parallel with other crates, so it is usually not noticable.

Ok(cfg) => cfg,
Err(e) => {
println!(
"cargo:warning=lock_api: unable to determine rustc version: {}",
Copy link
Owner

Choose a reason for hiding this comment

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

I'd just use an unwrap here. There's no reason we shouldn't be able to detect the rustc version, and if we can't then it would be better to loudly fail so it can be fixed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to panic on rustc version detection failure.

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.

When am I going to be able to use Mutex::new stablely?
3 participants