sync: make const_new methods always available (#5885)

Since MSRV is bumped to 1.63, `Mutex::new` is now usable in const context.

Also use `assert!` in const function to ensure correctness instead of
silently truncating the value and remove cfg `tokio_no_const_mutex_new`.

Signed-off-by: Jiahao XU <[email protected]>
This commit is contained in:
Jiahao XU
2023-07-28 13:46:21 +02:00
committed by GitHub
parent fb08591b43
commit efe3ab679a
12 changed files with 253 additions and 285 deletions
-6
View File
@@ -442,7 +442,6 @@ jobs:
# Run a platform without AtomicU64 and no const Mutex::new
- target: armv5te-unknown-linux-gnueabi
rustflags: --cfg tokio_no_const_mutex_new
steps:
- uses: actions/checkout@v3
- name: Install Rust stable
@@ -485,7 +484,6 @@ jobs:
# Run a platform without AtomicU64 and no const Mutex::new
- target: armv5te-unknown-linux-gnueabi
rustflags: --cfg tokio_no_const_mutex_new
steps:
- uses: actions/checkout@v3
- name: Install Rust stable
@@ -568,10 +566,6 @@ jobs:
# https://github.com/tokio-rs/tokio/pull/5356
# https://github.com/tokio-rs/tokio/issues/5373
- name: Check without const_mutex_new
run: cargo hack check -p tokio --feature-powerset --depth 2 --keep-going
env:
RUSTFLAGS: --cfg tokio_unstable --cfg tokio_taskdump -Dwarnings --cfg tokio_no_atomic_u64 --cfg tokio_no_const_mutex_new
- name: Check with const_mutex_new
run: cargo hack check -p tokio --feature-powerset --depth 2 --keep-going
env: