Skip to content

impl ... for Box<CoreType> in alloc should not require #[cfg(not(test))] #135100

Open
@joshtriplett

Description

@joshtriplett

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.

  1. This workaround shouldn't be necessary.

  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-bugCategory: This is a bug.E-needs-investigationCall for partcipation: This issues needs some investigation to determine current statusT-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions