Skip to content

Commit

Permalink
Improve compile_error! message
Browse files Browse the repository at this point in the history
  • Loading branch information
josephlr committed Jun 16, 2019
1 parent 25bd5a5 commit 8053d7e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/rdrand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ unsafe fn rdrand() -> Result<[u8; WORD_SIZE], Error> {
Err(Error::UNKNOWN)
}

// "rdrand" target feature requires "+rdrnd" flag, see https://github.com/rust-lang/rust/issues/49653.
#[cfg(all(target_env = "sgx", not(target_feature = "rdrand")))]
compile_error!("SGX targets must enable RDRAND to get randomness");
compile_error!(
"SGX targets require 'rdrand' target feature. Enable by using -C target-feature=+rdrnd."
);

// TODO use is_x86_feature_detected!("rdrand") when that works in core. See:
// https://github.com/rust-lang-nursery/stdsimd/issues/464
Expand Down

0 comments on commit 8053d7e

Please sign in to comment.