From be87c1c7e06c4932ba35579dcf154f1360ecb573 Mon Sep 17 00:00:00 2001 From: Cryptjar Date: Sat, 2 Apr 2022 18:31:13 +0200 Subject: [PATCH 1/2] Make (hopefully) docs.rs work again. Since the last that docs were build, at least two of our used feature gates got remove form the Rust compiler, while we are still stuck with a one year old compiler version, docs.rs always uses the latest. Therefore, we cfg-away all the feature gates and code that uses them when generate documentation. --- src/lib.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 1c5925a..34a50ca 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,14 +2,14 @@ #![no_std] // // We need inline assembly for the `lpm` instruction. -#![feature(llvm_asm)] +// However, it seems in more recent Rust version there is no more `llvm_asm`. +// And docs.rs uses the latest Rust version. +#![cfg_attr(not(doc), feature(llvm_asm))] // // We need const generics, however the `const_generics` feature is reported as // incomplete, thus we actually use the `min_const_generics` feature, which is -// sufficient for us. However, min_const_generics in turn fails to work with -// `cargo doc`, thus when documenting we fallback to the incomplete -// `const_generics` feature, because it has actual doc support. -#![cfg_attr(doc, feature(const_generics))] +// sufficient for us. However, `min_const_generics` in turn fails to work with +// `cargo doc`. #![cfg_attr(not(doc), feature(min_const_generics))] //! @@ -518,7 +518,7 @@ macro_rules! progmem { /// pub unsafe fn read_byte(p_addr: *const u8) -> u8 { cfg_if! { - if #[cfg(target_arch = "avr")] { + if #[cfg(all(target_arch = "avr", not(doc)))] { // Only addresses below the 64 KiB limit are supported! // Apparently this is of no concern for architectures with true // 16-bit pointers. @@ -655,7 +655,7 @@ unsafe fn read_asm_loop_raw(p_addr: *const T, out: *mut T, len: u8) { cfg_if! { - if #[cfg(target_arch = "avr")] { + if #[cfg(all(target_arch = "avr", not(doc)))] { // Only addresses below the 64 KiB limit are supported // Apparently this is of no concern for architectures with true // 16-bit pointers. From 5065cb3e1a88ecf1ec794b54eaed975f2b95c2d1 Mon Sep 17 00:00:00 2001 From: Cryptjar Date: Sat, 2 Apr 2022 18:32:20 +0200 Subject: [PATCH 2/2] Bump version to 0.1.4 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 20e3027..8d92d36 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "avr-progmem" -version = "0.1.3" +version = "0.1.4" authors = ["Cryptjar "] license = "Apache-2.0" edition = "2018"