Skip to content

#[global_allocator] and #[thread_local] should not be usable together on the same static #85517

@repnop

Description

@repnop

As per #85487 (comment), using both #[global_allocator] and #[thread_local] is currently allowed but should not be since the Global allocator is always Sync + Send which means that even if the type implementing GlobalAlloc is neither, allocations using the default Global allocator can be sent between threads which is unsound as they would be deallocated in a different allocator.

Metadata

Metadata

Assignees

Labels

A-allocatorsArea: Custom and system allocatorsC-bugCategory: This is a bug.F-thread_local`#![feature(thread_local)]`T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions