-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Fix LazyLock
poison panic message
#145307
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 and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
2aea6c2
to
e77c6fc
Compare
☔ The latest upstream changes (presumably #145489) made this pull request unmergeable. Please resolve the merge conflicts. |
e77c6fc
to
3ead751
Compare
This comment has been minimized.
This comment has been minimized.
@bjorn3 just a bump on my question in #145307 (comment), do you think it makes sense to add an argument to every implementation's Though I might be misunderstanding something: My understanding of the issue here is just that |
A foreign exception would be for example a C++ exception that unwinds though Rust code. Foreign exceptions can't be safely catched and rethrown. For example for C++ this would require calling a C++ runtime function to link the exception from the list of exceptions and later relink it. We can't do this in Rust as we can't depend on any particular C++ runtime or even any C++ runtime existing at all. For this reason trying to catch a foreign exception currently aborts the entire process. |
3ead751
to
8e848c0
Compare
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
8e848c0
to
d1f2324
Compare
This comment has been minimized.
This comment has been minimized.
Fixes an issue where if the underlying `Once` panics because it is poisoned, the panic displays the wrong message. Signed-off-by: Connor Tsui <[email protected]>
d1f2324
to
06eb782
Compare
#[test] | ||
#[should_panic = "has previously been poisoned"] | ||
fn lazy_force_mut_panic() { | ||
let mut lazy = LazyLock::<String>::new(|| panic!()); | ||
panic::catch_unwind(panic::AssertUnwindSafe(|| { | ||
let _ = LazyLock::force_mut(&mut lazy); | ||
})) | ||
.unwrap_err(); | ||
let _ = &*lazy; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is moved down and renamed to lazy_deref_mut_panic
@bors r+ |
…r=Amanieu Fix `LazyLock` poison panic message Fixes the issue raised in rust-lang#144872 (comment) r? `@Amanieu`
Rollup of 7 pull requests Successful merges: - #144452 (std/sys/fd: Relax `READ_LIMIT` on Darwin) - #145307 (Fix `LazyLock` poison panic message) - #145515 (Optimize `char::encode_utf8`) - #145540 (interpret/allocation: get_range on ProvenanceMap) - #145774 (Remove default opts from config) - #145780 (Do not warn about missing change ID in tarball builds) - #145781 (Remove profile section from Clippy) r? `@ghost` `@rustbot` modify labels: rollup
…r=Amanieu Fix `LazyLock` poison panic message Fixes the issue raised in rust-lang#144872 (comment) r? ``@Amanieu``
…r=Amanieu Fix `LazyLock` poison panic message Fixes the issue raised in rust-lang#144872 (comment) r? `@Amanieu`
…r=Amanieu Fix `LazyLock` poison panic message Fixes the issue raised in rust-lang#144872 (comment) r? ``@Amanieu``
Rollup of 6 pull requests Successful merges: - #144531 (Add lint against integer to pointer transmutes) - #144885 (Implement some more checks in `ptr_guaranteed_cmp`. ) - #145307 (Fix `LazyLock` poison panic message) - #145554 (rustc-dev-guide subtree update) - #145798 (Use unnamed lifetime spans as primary spans for `MISMATCHED_LIFETIME_SYNTAXES`) - #145799 (std/src/lib.rs: mention "search button" instead of "search bar") r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 5 pull requests Successful merges: - #144531 (Add lint against integer to pointer transmutes) - #145307 (Fix `LazyLock` poison panic message) - #145554 (rustc-dev-guide subtree update) - #145798 (Use unnamed lifetime spans as primary spans for `MISMATCHED_LIFETIME_SYNTAXES`) - #145799 (std/src/lib.rs: mention "search button" instead of "search bar") r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #145307 - connortsui20:lazylock-poison-msg, r=Amanieu Fix `LazyLock` poison panic message Fixes the issue raised in #144872 (comment) r? ```@Amanieu```
still in queue @bors r- |
@bors r- retry |
Rollup of 5 pull requests Successful merges: - rust-lang/rust#144531 (Add lint against integer to pointer transmutes) - rust-lang/rust#145307 (Fix `LazyLock` poison panic message) - rust-lang/rust#145554 (rustc-dev-guide subtree update) - rust-lang/rust#145798 (Use unnamed lifetime spans as primary spans for `MISMATCHED_LIFETIME_SYNTAXES`) - rust-lang/rust#145799 (std/src/lib.rs: mention "search button" instead of "search bar") r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 5 pull requests Successful merges: - rust-lang/rust#144531 (Add lint against integer to pointer transmutes) - rust-lang/rust#145307 (Fix `LazyLock` poison panic message) - rust-lang/rust#145554 (rustc-dev-guide subtree update) - rust-lang/rust#145798 (Use unnamed lifetime spans as primary spans for `MISMATCHED_LIFETIME_SYNTAXES`) - rust-lang/rust#145799 (std/src/lib.rs: mention "search button" instead of "search bar") r? `@ghost` `@rustbot` modify labels: rollup
Fixes the issue raised in #144872 (comment)
r? @Amanieu