rust/tests
Luigi Sartor Piucco 8a8717e971
fix: don't panic on volatile access to null
According to
https://discourse.llvm.org/t/rfc-volatile-access-to-non-dereferenceable-memory-may-be-well-defined/86303/4,
LLVM allows volatile operations on null and handles it correctly. This
should be allowed in Rust as well, because I/O memory may be hard-coded
to address 0 in some cases, like the AVR chip ATtiny1626.

A test case that ensured a failure when passing null to volatile was
removed, since it's now valid.

Due to the addition of `maybe_is_aligned` to `ub_checks`,
`maybe_is_aligned_and_not_null` was refactored to use it.

docs: revise restrictions on volatile operations

A distinction between usage on Rust memory vs. non-Rust memory was
introduced. Documentation was reworded to explain what that means, and
make explicit that:

- No trapping can occur from volatile operations;
- On Rust memory, all safety rules must be respected;
- On Rust memory, the primary difference from regular access is that
  volatile always involves a memory dereference;
- On Rust memory, the only data affected by an operation is the one
  pointed to in the argument(s) of the function;
- On Rust memory, provenance follows the same rules as non-volatile
  access;
- On non-Rust memory, any address known to not contain Rust memory is
  valid (including 0 and usize::MAX);
- On non-Rust memory, no Rust memory may be affected (it is implicit
  that any other non-Rust memory may be affected, though, even if not
  referenced by the pointer). This should be relevant when, for example,
  reading register A causes a flag to change in register B, or writing
  to A causes B to change in some way. Everything affected mustn't be
  inside an allocation.
- On non-Rust memory, provenance is irrelevant and a pointer with none
  can be used in a valid way.

fix: don't lint null as UB for volatile

Also remove a now-unneeded `allow` line.

fix: additional wording nits
2025-07-18 13:41:34 -03:00
..
assembly emit .att_syntax when global/naked asm use that option 2025-07-09 01:09:55 +02:00
auxiliary make cfg_select a builtin macro 2025-07-13 14:34:40 +02:00
codegen Rollup merge of #143880 - Enselic:fn-parameters-on-different-lines-debuginfo, r=wesleywiser 2025-07-17 10:41:46 +02:00
codegen-units Auto merge of #142893 - Mark-Simulacrum:no-const-collect, r=oli-obk 2025-06-27 12:57:05 +00:00
coverage Remove let_chains feature 2025-06-30 07:49:20 -05:00
coverage-run-rustdoc
crashes Rollup merge of #143895 - compiler-errors:trait-wc-item-bound-host-eff, r=oli-obk 2025-07-17 03:58:34 +02:00
debuginfo tests: {Meta,Pointee}Sized in non-minicore tests 2025-06-16 23:04:33 +00:00
incremental Bless incremental tests. 2025-07-13 13:50:01 +00:00
mir-opt Auto merge of #142903 - cjgillot:local-def-path-hash, r=compiler-errors 2025-07-17 08:36:42 +00:00
pretty Rewrite empty attribute lint 2025-07-06 09:51:35 +02:00
run-make Rollup merge of #143837 - jieyouxu:symbol-apis, r=ChrisDenton 2025-07-15 12:52:39 +02:00
rustdoc Add regression test for #143107 2025-07-10 11:41:50 +02:00
rustdoc-gui Update rustdoc GUI tests 2025-07-01 15:49:45 +02:00
rustdoc-js Migrate some tests away from concat-idents 2025-06-24 10:54:54 +00:00
rustdoc-js-std add doc(alias("AsciiChar")) to core::ascii::Char 2025-06-20 11:11:51 -05:00
rustdoc-json rustdoc-json: Structured attributes 2025-07-15 16:52:41 +00:00
rustdoc-ui refactor: Make -Ztrack-diagnostics emit like a note 2025-07-03 07:19:25 -06:00
ui fix: don't panic on volatile access to null 2025-07-18 13:41:34 -03:00
ui-fulldeps rename stable_mir to rustc_public, and rustc_smir to rustc_public_bridge 2025-07-14 09:25:54 +00:00
COMPILER_TESTS.md