mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-06 01:38:35 +00:00
make volatile operations const This came up in https://github.com/gfx-rs/wgpu/issues/8897#issuecomment-4894447055. The tl;dr is that it can be useful to have shared codepaths between things that need to work on special memory (and hence need to use volatile) and things that work on regular Rust memory, and for the regular Rust memory case those things totally could and should be `const fn`. So, let's (unstably, for now) allow volatile reads and writes in `const`, and specify them to behave just like normal reads and writes. In const we *know* that there's nobody trying to observe those locations so there's nothing special we have to do with those accesses. Cc @rust-lang/opsem @rust-lang/wg-const-eval Tracking issue: https://github.com/rust-lang/rust/issues/159094