Closed Bug 1524684 Opened 8 months ago Closed 8 months ago

m-c fails to build with nightly Rust: "error: use of deprecated item 'std::sync::atomic::ATOMIC_USIZE_INIT': the `new` function is now preferred"

Categories

(Testing :: geckodriver, defect, P1)

Version 3
defect

Tracking

(firefox67 fixed)

RESOLVED FIXED
mozilla67
Tracking Status
firefox67 --- fixed

People

(Reporter: botond, Assigned: ato)

References

Details

Attachments

(2 files)

I'm trying to build mozilla-central with nightly Rust, and I'm getting the following errors:

3:45.60 error: use of deprecated item 'std::sync::atomic::ATOMIC_USIZE_INIT': the `new` function is now preferred
 3:45.60   --> testing/geckodriver/src/logging.rs:34:48
 3:45.60    |
 3:45.60 34 | use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT};
 3:45.60    |                                                ^^^^^^^^^^^^^^^^^
 3:45.60    |
 3:45.60    = note: `-D deprecated` implied by `-D warnings`
 3:45.60 error: use of deprecated item 'std::sync::atomic::ATOMIC_USIZE_INIT': the `new` function is now preferred
 3:45.60   --> testing/geckodriver/src/logging.rs:40:37
 3:45.60    |
 3:45.60 40 | static MAX_LOG_LEVEL: AtomicUsize = ATOMIC_USIZE_INIT;
 3:45.60    |                                     ^^^^^^^^^^^^^^^^^
 3:45.60 error: aborting due to 2 previous errors
 3:45.64 error: Could not compile `geckodriver`.

Later there is also:

4:15.72 error: use of deprecated item 'std::error::Error::cause': replaced by Error::source, which can support downcasting
 4:15.72   --> media/audioipc/audioipc/src/errors.rs:10:1
 4:15.72    |
 4:15.72 10 | / error_chain! {
 4:15.72 11 | |     // Maybe replace with chain_err to improve the error info.
 4:15.72 12 | |     foreign_links {
 4:15.72 13 | |         Bincode(bincode::Error);
 4:15.72 ...  |
 4:15.72 21 | |     }
 4:15.72 22 | | }
 4:15.72    | |_^
 4:15.72    |
 4:15.72    = note: `-D deprecated` implied by `-D warnings`
 4:15.72    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
 4:15.72 error: use of deprecated item 'std::error::Error::cause': replaced by Error::source, which can support downcasting
 4:15.72   --> media/audioipc/audioipc/src/errors.rs:10:1
 4:15.72    |
 4:15.72 10 | / error_chain! {
 4:15.72 11 | |     // Maybe replace with chain_err to improve the error info.
 4:15.72 12 | |     foreign_links {
 4:15.72 13 | |         Bincode(bincode::Error);
 4:15.72 ...  |
 4:15.72 21 | |     }
 4:15.72 22 | | }
 4:15.72    | |_^
 4:15.72    |
 4:15.72    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
 4:15.72 error: aborting due to 2 previous errors

(In reply to Botond Ballo [:botond] from comment #0)

Later there is also:

4:15.72 error: use of deprecated item 'std::error::Error::cause': replaced by Error::source, which can support downcasting
 4:15.72   --> media/audioipc/audioipc/src/errors.rs:10:1

This is unrelated to geckodriver and should be filed under the media component.

In regards of the geckodriver problem it would be nice to see when this will reach Rust stable, but I think it would be good to have it fixed for the 0.25.0 release.

Blocks: 1520585

(In reply to Henrik Skupin (:whimboo) [⌚️UTC+1] from comment #1)

This is unrelated to geckodriver and should be filed under the media component.

Good point, filed bug 1524818.

Thanks for reporting this! It’s an easy fix.

Assignee: nobody → ato
Status: NEW → ASSIGNED
Priority: -- → P1

Explicit const static lifetime definitions are not required and
makes for complicated types. This patch simplifies the const assignemnt.

Depends on D18680

ATOMIC_USIZE_INIT is deprecated and removed in Rust nightly (1.34.0).
The replacement is AtomicUsize::new(), which takes a usize argument.
The default argument of ATOMIC_USIZE_INIT was 0, so we'll use that.

Setting MAX_LOG_LEVEL to 0 effectively disables all logging
until logging::init() or ::init_with_level() is called, setting
MAX_LOG_LEVEL to the appropriate logging::Level value.

Pushed by atolfsen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ceb9fac8ba25
geckodriver: ATOMIC_USIZE_INIT is deprecated; r=jgraham
https://hg.mozilla.org/integration/autoland/rev/9dc660f5c8b7
geckodriver: remove static definition of LOGGED_TARGETS; r=jgraham
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla67
You need to log in before you can comment on or make changes to this bug.