Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable rand_chacha with debug_assertions #120

Merged
merged 1 commit into from
Nov 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/kernel/random.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#[cfg(not(test))]
#[cfg(not(debug_assertions))]
use rand_chacha::ChaChaRng;
#[cfg(not(test))]
#[cfg(not(debug_assertions))]
use rand_core::{RngCore, SeedableRng};
use x86_64::instructions::random::RdRand;

// FIXME: Compiling this in test generate the following error:
// FIXME: Compiling this with debug_assertions generate the following error:
// LLVM ERROR: Do not know how to split the result of this operator!
#[cfg(not(test))]
#[cfg(not(debug_assertions))]
pub fn get_u64() -> u64 {
let mut seed = [0u8; 32];
if let Some(rdrand) = RdRand::new() {
Expand All @@ -24,7 +24,7 @@ pub fn get_u64() -> u64 {
chacha.next_u64()
}

#[cfg(test)]
#[cfg(debug_assertions)]
pub fn get_u64() -> u64 {
if let Some(rdrand) = RdRand::new() {
if let Some(rand) = rdrand.get_u64() {
Expand Down