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

Deprecation warnings for atomic types #736

Closed
vks opened this issue Feb 21, 2019 · 1 comment
Closed

Deprecation warnings for atomic types #736

vks opened this issue Feb 21, 2019 · 1 comment

Comments

@vks
Copy link
Collaborator

vks commented Feb 21, 2019

Starting with Rust 1.34, ATOMIC_*_INIT is deprecated in favor of Atomic*::new. However, this requires the function to be const, which is not supported on old Rust versions. I see the following options to silence the deprecation warnings:

  1. Use build.rs and autocfg to check for Rust 1.34 and use Atomic*::new accordingly.
  2. Silence the deprecation warning.

The disadvantage of 1. is that it will requires adding a build.rs to rand_os and rand_jitter, increasing build time by about one second. For now, it might be better to just go with 2.

@dhardy
Copy link
Member

dhardy commented Feb 21, 2019

Agreed, if we can silence just this warning then doing so with a comment makes the most sense.

vks added a commit to vks/rand that referenced this issue Feb 21, 2019
Since Rust 1.34, `ATOMIC_*_INIT` is deprecated in favor of
`Atomic*::new`. However, this requires the latter to be `const`, which
is not the case for older Rust versions.

Alternatively, we could detect the Rust version by introducing build
scripts to the crates lacking them. However, this increases build time
for a very minor benefit, so the deprecation warnings are ignored
instead.

Fixes rust-random#736.
vks added a commit to vks/rand that referenced this issue Feb 25, 2019
Since Rust 1.34, `ATOMIC_*_INIT` is deprecated in favor of
`Atomic*::new`. However, this requires the latter to be `const`, which
is not the case for older Rust versions.

Alternatively, we could detect the Rust version by introducing build
scripts to the crates lacking them. However, this increases build time
for a very minor benefit, so the deprecation warnings are ignored
instead.

Fixes rust-random#736.
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

No branches or pull requests

2 participants