Skip to content

#[track_caller] for std::sync::Once #87707

Closed
@lukaslueg

Description

@lukaslueg

POISONED if !ignore_poisoning => {
// Panic to propagate the poison.
panic!("Once instance has previously been poisoned");
}

Trying to initialize a poisoned Once does not track it's caller, yielding panic messages like

thread 'null_data' panicked at 'Once instance has previously been poisoned', library/std/src/sync/once.rs:392:21

Can we add #[track_caller] here? I've seen previous PRs regarding other performance-critical methods get rejected due to the overhead (?) track_caller has.

Metadata

Metadata

Assignees

Labels

C-enhancementCategory: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-help-wantedCall for participation: Help is requested to fix this issue.F-track_caller`#![feature(track_caller)]`I-needs-decisionIssue: In need of a decision.T-libsRelevant to the library team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions