From 5c3866c74aaf69228557e964b2e40d4198ddd9f7 Mon Sep 17 00:00:00 2001 From: Joe Richey Date: Thu, 28 May 2020 17:10:06 -0700 Subject: [PATCH] Rename "cpu" feature to "rdrand" Signed-off-by: Joe Richey --- .travis.yml | 4 ++-- src/lib.rs | 4 ++-- src/{test_cpu.rs => test_rdrand.rs} | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) rename src/{test_cpu.rs => test_rdrand.rs} (71%) diff --git a/.travis.yml b/.travis.yml index a5f74cde..3d3e443c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -145,11 +145,11 @@ jobs: script: # We test that getrandom builds for all targets - echo $STD_TARGETS | xargs -t -n1 cargo build --target - - echo $NO_STD_TARGETS | xargs -t -n1 cargo xbuild --features=cpu --target + - echo $NO_STD_TARGETS | xargs -t -n1 cargo xbuild --features=rdrand --target # also test minimum dependency versions are usable - cargo generate-lockfile -Z minimal-versions - echo $STD_TARGETS | xargs -t -n1 cargo build --target - - echo $NO_STD_TARGETS | xargs -t -n1 cargo xbuild --features=cpu --target + - echo $NO_STD_TARGETS | xargs -t -n1 cargo xbuild --features=rdrand --target # Trust cross-built/emulated targets. We must repeat all non-default values. - name: "Linux (MIPS, big-endian)" diff --git a/src/lib.rs b/src/lib.rs index b595b4bf..b988445c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -183,7 +183,7 @@ cfg_if! { #[path = "windows.rs"] mod imp; } else if #[cfg(all(target_arch = "x86_64", target_env = "sgx"))] { #[path = "rdrand.rs"] mod imp; - } else if #[cfg(all(feature = "cpu", + } else if #[cfg(all(feature = "rdrand", any(target_arch = "x86_64", target_arch = "x86")))] { #[path = "rdrand.rs"] mod imp; } else if #[cfg(feature = "custom")] { @@ -219,4 +219,4 @@ pub fn getrandom(dest: &mut [u8]) -> Result<(), Error> { #[cfg(test)] mod test_common; #[cfg(test)] -mod test_cpu; +mod test_rdrand; diff --git a/src/test_cpu.rs b/src/test_rdrand.rs similarity index 71% rename from src/test_cpu.rs rename to src/test_rdrand.rs index 7a9a0669..fafa6acc 100644 --- a/src/test_cpu.rs +++ b/src/test_rdrand.rs @@ -1,4 +1,4 @@ -// We only test the CPU-based RNG source on supported architectures. +// We only test the RDRAND-based RNG source on supported architectures. #![cfg(any(target_arch = "x86_64", target_arch = "x86"))] #[path = "rdrand.rs"]