You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1010: Fix ownership invalidation of saved scope panics r=cuviper a=cuviper
Miri complained when we tried to reconstruct a panic `Box` from an
`AtomicPtr`, because a later call to `mem::forget` invalidated that
pointer, even though we just meant not to drop it. `ManuallyDrop` is a
way to accomplish that *before* we take the pointer.
```
test scope::test::panic_propagate_nested_scope_spawn - should panic ... error: Undefined Behavior: trying to retag from <547680> for Unique permission at alloc207942[0x0], but that tag does not exist in the borrow stack for this location
--> ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1014:9
|
1014 | Box(unsafe { Unique::new_unchecked(raw) }, alloc)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| trying to retag from <547680> for Unique permission at alloc207942[0x0], but that tag does not exist in the borrow stack for this location
| this error occurs as part of retag at alloc207942[0x0..0x10]
|
= help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
= help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
help: <547680> was created by a SharedReadWrite retag at offsets [0x0..0x10]
--> rayon-core/src/scope/mod.rs:732:36
|
732 | .compare_exchange(nil, &mut *err, Ordering::Release, Ordering::Relaxed)
| ^^^^^^^^^
help: <547680> was later invalidated at offsets [0x0..0x10] by a Unique retag
--> rayon-core/src/scope/mod.rs:735:25
|
735 | mem::forget(err); // ownership now transferred into self.panic
| ^^^
```
Co-authored-by: Josh Stone <[email protected]>
0 commit comments