Get rid of the unused_unsafe warning on old versions of Rust.

This commit is contained in:
Jan Bujak 2023-04-11 11:55:47 +00:00
parent 996b1e9077
commit 738cfee020
No known key found for this signature in database
GPG key ID: 3B438F83D43341D4
2 changed files with 8 additions and 0 deletions

View file

@ -27,6 +27,13 @@ fn main() {
{
println!("cargo:rustc-cfg=nightly");
}
let rustc_version = rustc_version::version().expect("failed to detect rustc version");
if rustc_version.major == 1 && rustc_version.minor <= 64 {
// Old versions of Rust complain when you have an `unsafe fn` and you use `unsafe {}` inside,
// so for those we want to apply the `#[allow(unused_unsafe)]` attribute to get rid of that warning.
println!("cargo:rustc-cfg=allow_unused_unsafe");
}
}
// Deterministic cfg(curve25519_dalek_bits) when this is not explicitly set.

View file

@ -20,6 +20,7 @@
)]
#![cfg_attr(docsrs, feature(doc_auto_cfg, doc_cfg, doc_cfg_hide))]
#![cfg_attr(docsrs, doc(cfg_hide(docsrs)))]
#![cfg_attr(allow_unused_unsafe, allow(unused_unsafe))]
//------------------------------------------------------------------------
// Documentation:
//------------------------------------------------------------------------