Skip to content

thread_local!() can't take attributes #30756

Closed
@Manishearth

Description

@Manishearth
#![deny(unsafe_code)]

thread_local!(static KEY: u8 = 1);

fn main() {
}

will hit an unsafe_code warning due to an unsafe function internally defined in the thread local macro (the unsafe function is a recent addition). There's no way to allow() it.

The macro should take in attributes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions