diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 92c8b7c177477..2744cd5ddf067 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -290,6 +290,7 @@ #![feature(nonnull_slice_from_raw_parts)] #![feature(once_cell)] #![feature(auto_traits)] +#![feature(option_result_unwrap_unchecked)] #![feature(or_patterns)] #![feature(panic_info_message)] #![feature(panic_internals)] diff --git a/library/std/src/sys/wasm/thread.rs b/library/std/src/sys/wasm/thread.rs index 95a9230aa7888..0f354888c135f 100644 --- a/library/std/src/sys/wasm/thread.rs +++ b/library/std/src/sys/wasm/thread.rs @@ -86,7 +86,7 @@ pub fn my_id() -> u32 { if MY_ID == 0 { let mut cur = NEXT_ID.load(SeqCst); MY_ID = loop { - let next = cur.checked_add(1).unwrap_or_else(|| crate::arch::wasm32::unreachable()); + let next = cur.checked_add(1).unwrap_unchecked(); match NEXT_ID.compare_exchange(cur, next, SeqCst, SeqCst) { Ok(_) => break next, Err(i) => cur = i,