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 AtomicCell::is_lock_free const function at 1.46+ #546

Merged
2 commits merged into from Aug 29, 2020

Conversation

taiki-e
Copy link
Member

@taiki-e taiki-e commented Aug 25, 2020

Closes #531

Comment on lines +109 to +110
#[const_fn("1.46")]
pub const fn is_lock_free() -> bool {
Copy link
Member Author

Choose a reason for hiding this comment

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

#[const_fn] is proc-macro, but it is very simple and has no proc-macro related dependencies, so it has little impact on compile time.

@taiki-e taiki-e requested a review from a user August 25, 2020 06:44
Copy link

@ghost ghost 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!

@ghost ghost merged commit 35515d9 into master Aug 29, 2020
@taiki-e taiki-e deleted the const-atomic-is-lock-free branch August 29, 2020 23:32
bors bot added a commit that referenced this pull request Nov 17, 2020
600: Make AtomicCell::is_lock_free always const fn r=Vtec234 a=taiki-e

`if` expression can only be used in const fn since Rust 1.46, so const `is_lock_free` was require Rust 1.46 (context: #531, #546).
However, when we replace uses of `if` expression with `|` and `&` operators, it seems `is_lock_free` can be used as const fn even in Rust 1.36.

r? @jeehoonkang or @Vtec234 

Co-authored-by: Taiki Endo <te316e89@gmail.com>
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Mark AtomicCell::is_lock_free() as const fn?
1 participant