rust-assert-no-alloc icon indicating copy to clipboard operation
rust-assert-no-alloc copied to clipboard

Failed doc tests when running `cargo test --release`

Open ErikNatanael opened this issue 2 years ago • 0 comments

Hi! Compilation fails at doc tests when running cargo test --release. When running cargo test it works fine and non doc tests also compile and run with cargo test --release. The error

error[E0412]: cannot find type `AllocDisabler` in this scope
  --> .../src/lib.rs:61:11
   |
61 | static A: AllocDisabler = AllocDisabler;
   |           ^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find value `AllocDisabler` in this scope
  --> .../src/lib.rs:61:27
   |
61 | static A: AllocDisabler = AllocDisabler;
   |                           ^^^^^^^^^^^^^ not found in this scope

In my lib.rs I have the following

#[allow(unused_imports)]
use assert_no_alloc::*;

#[cfg(debug_assertions)] // required when disable_release is set (default)
#[global_allocator]
static A: AllocDisabler = AllocDisabler;

Cargo.toml:

assert_no_alloc = { version = "1.1.2" }

ErikNatanael avatar Mar 18 '23 19:03 ErikNatanael