Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safety comment on Allocator trait likely incorrect #107040

Closed
programmerjake opened this issue Jan 18, 2023 · 0 comments · Fixed by #107916
Closed

Safety comment on Allocator trait likely incorrect #107040

programmerjake opened this issue Jan 18, 2023 · 0 comments · Fixed by #107916
Labels
A-allocators Area: Custom and system allocators A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools

Comments

@programmerjake
Copy link
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.
@Noratrieb Noratrieb added A-allocators Area: Custom and system allocators A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools labels Jan 19, 2023
Noratrieb added a commit to Noratrieb/rust that referenced this issue May 30, 2023
Noratrieb added a commit to Noratrieb/rust that referenced this issue May 30, 2023
@bors bors closed this as completed in 18c9baf May 30, 2023
thomcc pushed a commit to tcdi/postgrestd that referenced this issue Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-allocators Area: Custom and system allocators A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants