Skip to content

Safety comment on Allocator trait likely incorrect #107040

Closed
@programmerjake

Description

@programmerjake
Member

one of the safety requirements for the Allocator trait is:

/// * Memory blocks returned from an allocator must point to valid memory and retain their validity
/// until the instance and all of its clones are dropped,
///

afaict that's incorrect since, because of the validity requirements, it requires Allocators to never free any memory blocks until the Allocator and all clones are dropped.

It should instead be something like:

 /// * Memory blocks returned from an allocator that are [*currently allocated*] must point to
 ///   valid memory and retain their validity while they are [*currently allocated*] and at
 ///   least one of the instance and all of its clones has not been dropped.

Activity

added
A-allocatorsArea: Custom and system allocators
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and tools
on Jan 19, 2023
added 3 commits that reference this issue on May 30, 2023

Rollup merge of rust-lang#107916 - reez12g:issue-107040, r=Amanieu

5da322f

Rollup merge of rust-lang#107916 - reez12g:issue-107040, r=Amanieu

39ed4e2

Rollup merge of rust-lang#107916 - reez12g:issue-107040, r=Amanieu

18c9baf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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 tools

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @programmerjake@Noratrieb

      Issue actions

        Safety comment on Allocator trait likely incorrect · Issue #107040 · rust-lang/rust