Skip to content

std::sync::Once: Should Once be UnwindSafe or RefUnwindSafe? #43469

Closed
@joshlf

Description

@joshlf

Currently, the following program will not compile because Once isn't RefUnwindSafe. Is this the desired behavior, or should we consider making it RefUnwindSafe or UnwindSafe?

use std::sync::Once;
use std::panic::catch_unwind;

fn main() {
    let o = Once::new();
    catch_unwind(|| o.call_once(|| panic!("foo")));
}

Metadata

Metadata

Assignees

Labels

C-feature-requestCategory: A feature request, i.e: not implemented / a PR.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.T-libs-apiRelevant to the library API 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