rust/src/tools
Matthias Krüger 1b4b0e9a4d
Rollup merge of #125834 - workingjubilee:weaken-thir-unsafeck-for-addr-of-static-mut, r=compiler-errors
treat `&raw (const|mut) UNSAFE_STATIC` implied deref as safe

Fixes rust-lang/rust#125833

As reported in that and related issues, `static mut STATIC_MUT: T` is very often used in embedded code, and is in many ways equivalent to `static STATIC_CELL: SyncUnsafeCell<T>`. The Rust expression of `&raw mut STATIC_MUT` and `SyncUnsafeCell::get(&STATIC_CELL)` are approximately equal, and both evaluate to `*mut T`. The library function is safe because it has *declared itself* to be safe. However, the raw ref operator is unsafe because all uses of `static mut` are considered unsafe, even though the static's value is not used by this expression (unlike, for example, `&STATIC_MUT`).

We can fix this unnatural difference by simply adding the proper exclusion for the safety check inside the THIR unsafeck, so that we do not declare it unsafe if it is not.

While the primary concern here is `static mut`, this change is made for all instances of an "unsafe static", which includes a static declared inside `extern "abi" {}`. Hypothetically, we could go as far as generalizing this to all instances of `&raw (const|mut) *ptr`, but today we do not, as we have not actually considered the range of possible expressions that use a similar encoding. We do not even extend this to thread-local equivalents, because they have less clear semantics.
2024-07-23 13:06:54 +02:00
..
build-manifest Add wasm32-wasip2 to build-manifest tool 2024-07-17 08:31:40 -07:00
build_helper abstract merge-base commit logic 2024-07-17 18:14:54 +03:00
bump-stage0 move comments position in src/stage0 2024-05-11 20:49:01 +03:00
cargo@5f6b9a9220 Update cargo 2024-07-19 17:59:44 -04:00
cargotest
clippy Fix tools 2024-07-21 22:34:37 -04:00
collect-license-metadata Removed CondensedDirectory support from license tools. 2024-07-22 10:44:18 +01:00
compiletest Rollup merge of #127958 - jieyouxu:compiletest-rmake-cleanup, r=Kobzol 2024-07-20 19:28:59 +02:00
coverage-dump Add an alternate --demangle mode to coverage-dump 2024-05-31 21:52:45 +10:00
error_index_generator
generate-copyright Removed CondensedDirectory support from license tools. 2024-07-22 10:44:18 +01:00
generate-windows-sys Update windows-bindgen to 0.58.0 2024-07-04 12:18:38 +00:00
html-checker rustdoc: allow custom element rustdoc-search 2024-05-06 21:50:27 -07:00
jsondocck Update jsondocck directives to follow ui_test-style 2024-07-19 16:54:16 +02:00
jsondoclint Add rustdoc-json support for use<> 2024-07-12 05:24:51 -04:00
libcxx-version skip src/tools/libcxx-version from tidy 2024-06-06 07:01:37 +03:00
linkchecker add new_range_api for RFC 3550 2024-07-05 16:33:58 -06:00
lint-docs Rename deprecated_safe lint to deprecated_safe_2024 2024-07-17 14:39:56 +02:00
lld-wrapper Fix typos (taking into account review comments) 2024-05-18 18:12:18 +02:00
llvm-bitcode-linker Distribute LLVM bitcode linker as a preview component 2024-04-15 15:11:28 +02:00
miri Rollup merge of #125834 - workingjubilee:weaken-thir-unsafeck-for-addr-of-static-mut, r=compiler-errors 2024-07-23 13:06:54 +02:00
miropt-test-tools
opt-dist opt-dist: apply considerable clippy suggestions 2024-06-13 18:41:49 +03:00
remote-test-client Give remote-test-client a longer timeout 2024-07-02 10:09:40 -07:00
remote-test-server remote-test-server: apply considerable clippy suggestions 2024-06-13 18:41:43 +03:00
replace-version-placeholder
rls
run-make-support Auto merge of #127778 - Oneirical:artificial-intestlligence, r=jieyouxu 2024-07-23 01:51:57 +00:00
rust-analyzer Allow deprecated temporarily to unblock version bump 2024-07-20 15:51:58 -04:00
rust-installer use "bootstrap" instead of "rustbuild" in comments and docs 2024-07-07 00:07:08 +03:00
rustbook Move rustbook to its own workspace. 2024-07-22 07:20:57 -07:00
rustc-perf@c64bb60dd1 Update rustc-perf submodule 2024-06-12 11:45:52 +02:00
rustc-perf-wrapper Review changes 2024-06-29 16:07:22 +02:00
rustdoc Change SIGPIPE ui from #[unix_sigpipe = "..."] to -Zon-broken-pipe=... 2024-05-02 19:48:29 +02:00
rustdoc-gui Other EcmaScript version bump 2024-06-07 08:44:52 +08:00
rustdoc-gui-test compiletest: Allow multiple //@ run-flags: headers 2024-06-07 01:51:57 +10:00
rustdoc-js Other EcmaScript version bump 2024-06-07 08:44:52 +08:00
rustdoc-themes
rustfmt Implement RTN support in rustfmt 2024-06-28 14:20:44 -04:00
suggest-tests Remove direct dependencies on lazy_static, once_cell and byteorder 2024-04-28 14:35:00 +01:00
tidy Auto merge of #127778 - Oneirical:artificial-intestlligence, r=jieyouxu 2024-07-23 01:51:57 +00:00
tier-check
unicode-table-generator Add a lower bound check to unicode-table-generator output 2024-04-20 10:16:45 +02:00
unstable-book-gen
wasm-component-ld Promote the wasm32-wasip2 target to Tier 2 2024-07-09 12:11:08 -07:00
x
cherry-pick.sh
publish_toolstate.py CI: fix toolstate publishing 2024-05-15 15:48:52 +02:00