Remove double check when decoding ExpnId to avoid races#148306
Remove double check when decoding ExpnId to avoid races#148306bors merged 1 commit intorust-lang:masterfrom
Conversation
|
r? @nnethercote rustbot has assigned @nnethercote. Use |
|
cc @cjgillot |
I'm surprised you're seeing a debug assertion failure. Did you build your own compiler? As for the fix, it seems plausible, but I'm not familiar with this code. @Zoxc or @Mark-Simulacrum, can you evaluate this change? |
Yes, I did. I am trying to solve #141540, it is the most active I usually keep |
|
Ok, seems reasonable. @bors r+ rollup |
|
It indeed looks like |
Rollup of 8 pull requests Successful merges: - #135099 (Add FileCheck annotations to mir-opt/copy-prop) - #145903 (Give correct suggestion for a typo in raw pointers) - #147520 (Port the remaining SIMD intrinsics to const-eval) - #148068 (rustdoc: Use configured target modifiers when collecting doctests) - #148099 (Prepare to move debugger discovery from compiletest to bootstrap) - #148268 (rustdoc: fix `--emit=dep-info` on scraped examples) - #148306 (Remove double check when decoding ExpnId to avoid races) - #148378 (Fix documentation for std::panic::update_hook) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #148306 - zetanumbers:expn_id_decode, r=nnethercote Remove double check when decoding ExpnId to avoid races Fixes debug assertion failure as described in #141540 (comment) Essentially failure happens during the race while decoding one `ExpnId` from different threads. This ICE doesn't happen with single threaded thread_pool due to early return within `decode_expn_id` with the same condition: https://github.com/rust-lang/rust/blob/8205e6b75ec656305ac235d4726d2c7a1ddcef14/compiler/rustc_middle/src/query/on_disk_cache.rs#L605-L607 However I believe this race does not hurt because `register_expn_id` is pretty much idempotent: https://github.com/rust-lang/rust/blob/8205e6b75ec656305ac235d4726d2c7a1ddcef14/compiler/rustc_span/src/hygiene.rs#L1397-L1413
Rollup of 8 pull requests Successful merges: - rust-lang/rust#135099 (Add FileCheck annotations to mir-opt/copy-prop) - rust-lang/rust#145903 (Give correct suggestion for a typo in raw pointers) - rust-lang/rust#147520 (Port the remaining SIMD intrinsics to const-eval) - rust-lang/rust#148068 (rustdoc: Use configured target modifiers when collecting doctests) - rust-lang/rust#148099 (Prepare to move debugger discovery from compiletest to bootstrap) - rust-lang/rust#148268 (rustdoc: fix `--emit=dep-info` on scraped examples) - rust-lang/rust#148306 (Remove double check when decoding ExpnId to avoid races) - rust-lang/rust#148378 (Fix documentation for std::panic::update_hook) r? `@ghost` `@rustbot` modify labels: rollup
…llaumeGomez Rollup of 8 pull requests Successful merges: - rust-lang#135099 (Add FileCheck annotations to mir-opt/copy-prop) - rust-lang#145903 (Give correct suggestion for a typo in raw pointers) - rust-lang#147520 (Port the remaining SIMD intrinsics to const-eval) - rust-lang#148068 (rustdoc: Use configured target modifiers when collecting doctests) - rust-lang#148099 (Prepare to move debugger discovery from compiletest to bootstrap) - rust-lang#148268 (rustdoc: fix `--emit=dep-info` on scraped examples) - rust-lang#148306 (Remove double check when decoding ExpnId to avoid races) - rust-lang#148378 (Fix documentation for std::panic::update_hook) r? `@ghost` `@rustbot` modify labels: rollup
Fixes debug assertion failure as described in #141540 (comment)
Essentially failure happens during the race while decoding one
ExpnIdfrom different threads. This ICE doesn't happen with single threaded thread_pool due to early return withindecode_expn_idwith the same condition:rust/compiler/rustc_middle/src/query/on_disk_cache.rs
Lines 605 to 607 in 8205e6b
However I believe this race does not hurt because
register_expn_idis pretty much idempotent:rust/compiler/rustc_span/src/hygiene.rs
Lines 1397 to 1413 in 8205e6b