From b8603bd488e7ef7197b545ac67ab78c090a2a038 Mon Sep 17 00:00:00 2001 From: Joe Richey Date: Tue, 11 Jun 2024 15:01:42 -0700 Subject: [PATCH] MSRV 1.60: Conditionally import lasy.rs module This simplifies lib.rs and allows for our testing code to be less convoluted. The MSRV for rand 0.9 is 1.61 and Debian stable is 1.63, so this is a fine MSRV bump. Signed-off-by: Joe Richey --- .clippy.toml | 2 +- .github/workflows/tests.yml | 2 +- Cargo.toml | 2 +- README.md | 2 +- src/lazy.rs | 2 ++ src/lib.rs | 5 +---- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.clippy.toml b/.clippy.toml index 5cccb362..13f202e9 100644 --- a/.clippy.toml +++ b/.clippy.toml @@ -1 +1 @@ -msrv = "1.57" +msrv = "1.60" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b40f1c6f..78783854 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -44,7 +44,7 @@ jobs: strategy: matrix: os: [ubuntu-22.04, windows-2022] - toolchain: [nightly, beta, stable, 1.57] + toolchain: [nightly, beta, stable, "1.60"] # Only Test macOS on stable to reduce macOS CI jobs include: # x86_64-apple-darwin. diff --git a/Cargo.toml b/Cargo.toml index cea1309a..47c7fd28 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "getrandom" version = "0.2.15" # Also update html_root_url in lib.rs when bumping this edition = "2021" -rust-version = "1.57" # Sync .clippy.toml, tests.yml, and README.md. +rust-version = "1.60" # Sync .clippy.toml, tests.yml, and README.md. authors = ["The Rand Project Developers"] license = "MIT OR Apache-2.0" description = "A small cross-platform library for retrieving random data from system source" diff --git a/README.md b/README.md index 56af89dd..ef8a6ce2 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ crate features, WASM support and Custom RNGs see the ## Minimum Supported Rust Version -This crate requires Rust 1.57.0 or later. +This crate requires Rust 1.60.0 or later. ## Platform Support diff --git a/src/lazy.rs b/src/lazy.rs index 2b04c61d..10a43d0c 100644 --- a/src/lazy.rs +++ b/src/lazy.rs @@ -1,3 +1,5 @@ +//! Helpers built around pointer-sized atomics. +#![cfg(target_has_atomic = "ptr")] #![allow(dead_code)] use core::{ ffi::c_void, diff --git a/src/lib.rs b/src/lib.rs index d1e9ef09..f5e13c36 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -216,6 +216,7 @@ use crate::util::{slice_as_uninit_mut, slice_assume_init_mut}; use core::mem::MaybeUninit; mod error; +mod lazy; mod util; // To prevent a breaking change when targets are added, we always export the // register_custom_getrandom macro, so old Custom RNG crates continue to build. @@ -298,7 +299,6 @@ cfg_if! { ))] { mod util_libc; mod use_file; - mod lazy; mod linux_android; #[path = "linux_android_with_fallback.rs"] mod imp; } else if #[cfg(any(target_os = "android", target_os = "linux"))] { @@ -309,7 +309,6 @@ cfg_if! { #[path = "solaris.rs"] mod imp; } else if #[cfg(target_os = "netbsd")] { mod util_libc; - mod lazy; #[path = "netbsd.rs"] mod imp; } else if #[cfg(target_os = "fuchsia")] { #[path = "fuchsia.rs"] mod imp; @@ -331,11 +330,9 @@ cfg_if! { } else if #[cfg(windows)] { #[path = "windows.rs"] mod imp; } else if #[cfg(all(target_arch = "x86_64", target_env = "sgx"))] { - mod lazy; #[path = "rdrand.rs"] mod imp; } else if #[cfg(all(feature = "rdrand", any(target_arch = "x86_64", target_arch = "x86")))] { - mod lazy; #[path = "rdrand.rs"] mod imp; } else if #[cfg(all(feature = "js", any(target_arch = "wasm32", target_arch = "wasm64"),