Specify reentrancy gurantees of Once::call_once by matklad · Pull Request #53024 · rust-lang/rust (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation6 Commits2 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

matklad

I don't think the docs are clear about what happens in the following code

static INIT: Once = ONCE_INIT;

INIT.call_once(|| INIT.call_once(|| println!("huh?")));

Playground

Let's "specify" the behavior to make it clear that the current behavior (deadlock I think?) is not a strict guarantee.

@matklad

@rust-highfive

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@matklad

To expand a bit, I think we can guarantee a deadlock, but I can imagine that, for example, with debug_assertions we might want to escalate that to panic someday, so the aim here is to preserve the flexibility of implementation.

@rust-highfive

This comment has been minimized.

@matklad

@alexcrichton

@bors

📌 Commit a2f9aaf has been approved by alexcrichton

@bors bors added S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Aug 3, 2018

cramertj added a commit to cramertj/rust that referenced this pull request

Aug 3, 2018

@cramertj

kennytm added a commit to kennytm/rust that referenced this pull request

Aug 4, 2018

@kennytm

@kennytm

bors added a commit that referenced this pull request

Aug 4, 2018

@bors

Rollup of 14 pull requests

Successful merges:

Labels

S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.