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
jyn514
changed the title
Unsafe block not detected when accessing a union field inside a closure
2021 edition: Unsafe block not detected when accessing a union field inside a closure
Jul 22, 2021
2229: Don't capture preicese paths on top of a union
- Accessing fields of a union require unsafe block
- As part of 2229 we don't allow precision where we need an unsafe block
to capture.
Fixes: rust-lang#87378
r? `@nikomatsakis`
Code
I tried this code:
I expected to see this happen: no error
Instead, this happened:
error[E0133]: access to union field is unsafe and requires unsafe function or block
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=091d060959b30415131533f2e6d93f71
Version it worked on
rustc 1.55.0-nightly 2018 edition
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=091d060959b30415131533f2e6d93f71
Version with regression
rustc 1.55.0-nightly 2021 edition
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=091d060959b30415131533f2e6d93f71
The text was updated successfully, but these errors were encountered: