Files
rust/tests/ui
Matthias Krüger 6d7d366fd3 Rollup merge of #141260 - LuigiPiucco:volatile-null, r=RalfJung
Allow volatile access to non-Rust memory, including address 0

This PR relaxes the `ub_check` in the `read_volatile`/`write_volatile` pointer operations to allow passing null. This is needed to support processors which hard-code peripheral registers on address 0, like the AVR chip ATtiny1626. LLVM understands this as valid and handles it correctly, as tested in my [PR to add a note about it](https://github.com/llvm/llvm-project/pull/139803/commits/6387c82255c56d3035d249eb54110695e76b8030#diff-81bbb96298c32fa901beb82ab3b97add27a410c01d577c1f8c01000ed2055826) (rustc generates the same LLVM IR as expected there when this PR is applied, and consequently the same AVR assembly).

Follow-up and implementation of the discussions in:
- https://internals.rust-lang.org/t/pre-rfc-conditionally-supported-volatile-access-to-address-0/12881/7
- https://github.com/Rahix/avr-device/pull/185;
- [#t-lang > Adding the possibility of volatile access to address 0](https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/Adding.20the.20possibility.20of.20volatile.20access.20to.20address.200/with/513303502)
- https://discourse.llvm.org/t/rfc-volatile-access-to-non-dereferenceable-memory-may-be-well-defined/86303

r? ````@RalfJung````

Also fixes https://github.com/rust-lang/unsafe-code-guidelines/issues/29 (about as good as it'll get, null will likely never be a "normal" address in Rust)
2025-07-20 08:56:05 +02:00
..
2025-06-11 15:30:15 +01:00
2025-05-21 07:24:43 +00:00
2025-07-10 18:50:35 +05:00
2025-07-13 00:03:31 +05:00
2025-06-11 17:49:03 +05:00
2025-07-15 09:21:27 +02:00
2025-07-15 23:28:15 +02:00
2025-06-18 10:20:43 +02:00
2025-07-05 00:45:24 +05:00
2025-07-05 01:54:04 +05:00
2025-07-17 15:51:32 +05:00
2025-06-16 07:30:09 -04:00
2025-07-06 09:51:35 +02:00
2025-06-06 20:52:34 +00:00
2025-07-17 15:51:32 +05:00
2025-07-17 15:51:32 +05:00
2025-05-31 19:49:19 +05:00
2025-07-10 18:50:35 +05:00
2025-06-11 20:51:49 +05:00
2025-06-29 15:37:33 +05:00
2025-06-13 01:16:36 +02:00
2025-07-10 18:50:35 +05:00
2025-06-03 11:45:58 +02:00
2025-07-10 18:47:20 +05:00
2025-06-18 10:20:43 +02:00
2025-06-18 10:20:43 +02:00
2025-07-01 14:36:28 +02:00
2025-07-05 00:45:24 +05:00
2025-07-13 00:03:31 +05:00
2025-07-10 18:47:20 +05:00
2025-07-01 15:16:56 +05:00
2025-07-10 18:50:35 +05:00
2025-07-05 00:45:24 +05:00
2025-07-13 00:03:31 +05:00
2025-07-10 18:50:35 +05:00
2025-07-13 00:03:31 +05:00
2025-07-06 09:51:35 +02:00
2025-06-08 11:25:09 +05:00
2025-07-17 22:21:21 +00:00
2025-07-17 15:51:32 +05:00
2025-07-05 01:54:04 +05:00
2025-07-15 09:21:27 +02:00
2025-07-17 18:06:26 +08:00
2025-07-07 08:13:12 +00:00
2025-07-13 13:50:01 +00:00
2025-07-05 01:25:48 +05:00
2025-06-26 18:11:14 +00:00
2025-07-13 00:03:31 +05:00
2025-07-05 01:54:04 +05:00
2025-07-01 15:16:56 +05:00
2025-07-13 00:03:31 +05:00
2025-06-18 10:20:43 +02:00
2025-07-10 18:47:20 +05:00
2025-07-18 07:47:08 +00:00
2025-04-25 20:50:57 +09:00
2025-06-08 03:44:44 +05:00
2025-07-10 18:50:35 +05:00
2025-07-15 13:48:30 +00:00
2025-06-18 10:20:43 +02:00
2025-07-14 12:01:41 +03:00