rust/tests
bors b8495e5dd2 Auto merge of #130251 - saethlin:ptr-offset-preconditions, r=Amanieu
Add precondition checks to ptr::offset, ptr::add, ptr::sub

All of `offset`, `add`, and `sub` (currently) have the trivial preconditions that the offset in bytes must be <= isize::MAX, and the computation of the new address must not wrap. This adds precondition checks for these, and like in slice indexing, we use intrinsics directly to implement unsafe APIs that have explicit checks, because we get a clearer error message that mentions the misused API not an implementation detail.

Experimentation indicates these checks have 1-2% compile time overhead, due primarily to adding the checks for `add`.

A crater run (https://github.com/rust-lang/rust/pull/130251#issuecomment-2395824565) indicates some people currently have buggy calls to `ptr::offset` that apply a negative offset to a null pointer, but the crater run does not hit the `ptr::add` or `ptr::sub` checks, which seems like an argument for cfg'ing out those checks on account of their overhead.
2024-10-08 01:56:58 +00:00
..
assembly more asm! -> naked_asm! in tests 2024-10-06 18:12:25 +02:00
auxiliary
codegen Add precondition checks to ptr::offset, ptr::add, ptr::sub 2024-10-07 11:12:58 -04:00
codegen-units Fix and enable disabled codegen-units tests 2024-08-10 14:03:27 -04:00
coverage fix GVN trying to transmute pointers to integers 2024-10-05 17:55:23 +02:00
coverage-run-rustdoc coverage: Extract hole spans from HIR instead of MIR 2024-07-08 21:22:56 +10:00
crashes more asm! -> naked_asm! in tests 2024-10-06 18:12:25 +02:00
debuginfo Reorder stack spills so that constants come later. 2024-09-17 16:45:26 -07:00
incremental Bless incremental tests. 2024-10-04 23:50:01 +00:00
mir-opt Disable slice_iter mir-opt test in debug builds 2024-10-07 12:23:27 -04:00
pretty Use doc(hidden) instead of allow(missing_docs) in the test harness 2024-09-11 12:14:35 +02:00
run-make various fixes for naked_asm! implementation 2024-10-06 19:00:09 +02:00
rustdoc Auto merge of #131076 - lukas-code:doc-stab2, r=notriddle 2024-10-01 04:30:33 +00:00
rustdoc-gui Rollup merge of #131257 - GuillaumeGomez:fix-list-margins, r=notriddle 2024-10-04 14:11:38 -07:00
rustdoc-js rustdoc-search: allow trailing Foo -> arg search 2024-09-05 17:58:05 -07:00
rustdoc-js-std Fix rustdoc-js-std path-ordering test due to API removal 2024-10-02 11:15:48 +02:00
rustdoc-json Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
rustdoc-ui Rollup merge of #131260 - notriddle:notriddle/disambiguator-error, r=GuillaumeGomez 2024-10-04 19:19:25 -07:00
ui Rollup merge of #128721 - Brezak:pointee-in-strange-places, r=pnkfelix 2024-10-07 11:10:52 -07:00
ui-fulldeps Remove feature(control_flow_enum) in tests 2024-09-25 19:00:19 -07:00
COMPILER_TESTS.md