Skip to content

Commit

Permalink
Disable rand_chacha with debug_assertions (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
vinc authored Nov 15, 2020
1 parent 2df0be9 commit 5635dab
Showing 1 changed file with 5 additions and 5 deletions.
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

0 comments on commit 5635dab

Please sign in to comment.