Skip to content

Missing documentation/feature - changing global_allocator in cargo test #81953

Open
@Firstyear

Description

@Firstyear

Hi,

From https://github.com/rust-lang/rust/blob/master/library/core/src/alloc/global.rs#L5 this mentions how to use a different global allocator in the main of a binary. It would be beneficial to be able to use the same allocator in tests of that binary, or associated libraries and modules.

Can this documentation be extended to demonstrate how cargo test can use an alternate allocator? Alternately if this isn't possible today, can this be a feature request to allow the allocator to be changed with cargo test?

Thanks,

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-allocatorsArea: Custom and system allocatorsA-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-libtestArea: `#[test]` / the `test` libraryC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions