library/alloc/src/ffi/c_str.rs has:
#[cfg(not(test))]
#[stable(feature = "box_from_c_str", since = "1.17.0")]
impl From<&CStr> for Box<CStr> {
As far as I can tell, #[cfg(not(test))] is a workaround for something like #87534, as evidenced by error messages like:
note: the crate `alloc` is compiled multiple times, possibly with different configurations
alloc is being compiled a second time as part of tests, and the two compilations are conflicting.
-
This workaround shouldn't be necessary.
-
This should be much better documented, so it doesn't send people on multi-hour debugging adventures when they try to write new trait impls in alloc.
library/alloc/src/ffi/c_str.rshas:As far as I can tell,
#[cfg(not(test))]is a workaround for something like #87534, as evidenced by error messages like:note: the crate `alloc` is compiled multiple times, possibly with different configurationsallocis being compiled a second time as part of tests, and the two compilations are conflicting.This workaround shouldn't be necessary.
This should be much better documented, so it doesn't send people on multi-hour debugging adventures when they try to write new trait impls in
alloc.