Skip to content

Commit b052b16

Browse files
authored
Clean up deprecations (#8300)
* vm: replace fetch_update() with try_update() fetch_update() in atomic namespace is in the deprecation stage. * host_env: replace libc::RLIM_NLIMITS with const RLIM_NLIMITS Define a new const, RLIM_NLIMITS instead of libc::RLIM_NLIMITS in order to clean up the deprecated const and to prevent breaking API where the const is still used.
1 parent 20cb866 commit b052b16

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎crates/host_env/src/resource.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ pub use libc::{
77
RLIMIT_NOFILE, RLIMIT_NPROC, RLIMIT_RSS, RLIMIT_STACK, c_long, rlim_t, rlimit, timeval,
88
};
99

10-
#[cfg(target_os = "android")]
11-
pub use libc::RLIM_NLIMITS;
12-
1310
#[cfg(any(target_os = "linux", target_os = "android", target_os = "emscripten"))]
1411
pub use libc::{RLIMIT_MSGQUEUE, RLIMIT_NICE, RLIMIT_RTPRIO, RLIMIT_SIGPENDING};
1512

@@ -36,6 +33,9 @@ pub use libc::RUSAGE_THREAD;
3633
#[cfg(not(any(target_os = "windows", target_os = "redox")))]
3734
pub use libc::{RUSAGE_CHILDREN, RUSAGE_SELF};
3835

36+
#[cfg(target_os = "android")]
37+
pub const RLIM_NLIMITS: libc::c_int = 16;
38+
3939
#[derive(Debug, Clone, Copy)]
4040
pub struct RUsage {
4141
pub ru_utime: libc::timeval,

‎crates/vm/src/builtins/function.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static FUNC_VERSION_COUNTER: AtomicU32 = AtomicU32::new(1);
8787
/// Once the counter wraps to 0, it stays at 0 permanently.
8888
fn next_func_version() -> u32 {
8989
FUNC_VERSION_COUNTER
90-
.fetch_update(Relaxed, Relaxed, |v| (v != 0).then(|| v.wrapping_add(1)))
90+
.try_update(Relaxed, Relaxed, |v| (v != 0).then(|| v.wrapping_add(1)))
9191
.unwrap_or(0)
9292
}
9393

‎crates/vm/src/builtins/type.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ impl PyType {
680680
let flags_bits = flags.bits();
681681
let _ = self
682682
.abc_tpflags
683-
.fetch_update(Ordering::AcqRel, Ordering::Acquire, |old| {
683+
.try_update(Ordering::AcqRel, Ordering::Acquire, |old| {
684684
Some((old & !collection_bits) | flags_bits)
685685
});
686686
self.modified();

0 commit comments

Comments
 (0)