rust/src/tools
bors a9d17627d2 Auto merge of #128985 - GrigorenkoPV:instantly-dangling-pointer, r=Urgau
Lint against getting pointers from immediately dropped temporaries

Fixes #123613

## Changes:
1. New lint: `dangling_pointers_from_temporaries`. Is a generalization of `temporary_cstring_as_ptr` for more types and more ways to get a temporary.
2. `temporary_cstring_as_ptr` is removed and marked as renamed to `dangling_pointers_from_temporaries`.
3. `clippy::temporary_cstring_as_ptr` is marked as renamed to `dangling_pointers_from_temporaries`.
4. Fixed a false positive[^fp] for when the pointer is not actually dangling because of lifetime extension for function/method call arguments.
5. `core::cell::Cell` is now `rustc_diagnostic_item = "Cell"`

## Questions:
- [ ]  Instead of manually checking for a list of known methods and diagnostic items, maybe add some sort of annotation to those methods in library and check for the presence of that annotation? https://github.com/rust-lang/rust/pull/128985#issuecomment-2318714312

## Known limitations:

### False negatives[^fn]:

See the comments in `compiler/rustc_lint/src/dangling.rs`

1. Method calls that are not checked for:
   - `temporary_unsafe_cell.get()`
   - `temporary_sync_unsafe_cell.get()`
2. Ways to get a temporary that are not recognized:
   - `owning_temporary.field`
   - `owning_temporary[index]`
3. No checks for ref-to-ptr conversions:
   - `&raw [mut] temporary`
   - `&temporary as *(const|mut) _`
    - `ptr::from_ref(&temporary)` and friends

[^fn]: lint **should** be emitted, but **is not**

[^fp]: lint **should not** be emitted, but **is**
2024-10-29 00:24:07 +00:00
..
build-manifest Address review comments on wasm32v1-none target 2024-10-22 23:04:44 -07:00
build_helper Rollup merge of #131358 - onur-ozkan:129528, r=Mark-Simulacrum 2024-10-12 21:38:36 -05:00
bump-stage0 Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
cargo@e75214ea49 Update cargo 2024-10-25 15:29:02 -04:00
cargotest
clippy Auto merge of #128985 - GrigorenkoPV:instantly-dangling-pointer, r=Urgau 2024-10-29 00:24:07 +00:00
collect-license-metadata
compiletest Auto merge of #132244 - jyn514:linker-refactors, r=bjorn3 2024-10-28 10:44:24 +00:00
coverage-dump coverage: Include the highest counter ID seen in .cov-map dumps 2024-10-11 21:04:37 +11:00
enzyme@2fe5164a24 Enzyme backend 2024-09-05 22:47:23 -04:00
error_index_generator Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
generate-copyright Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
generate-windows-sys
html-checker rustdoc: redesign toolbar and disclosure widgets 2024-09-10 17:56:05 -07:00
jsondocck
jsondoclint Update rustc-hash to version 2 2024-10-20 00:12:49 -07:00
libcxx-version
linkchecker linkchecker: add a reminder on broken links to add new/renamed pages to SUMMARY.md for mdBooks 2024-10-15 20:46:16 +08:00
lint-docs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
lld-wrapper
llvm-bitcode-linker
miri Merge pull request #3995 from RalfJung/readdir_r 2024-10-26 16:01:50 +00:00
miropt-test-tools Emit error on skip-filecheck test containing filecheck directives 2024-10-19 13:24:07 +00:00
nix-dev-shell Add an option of using nix-shell instead of nix flake 2024-09-21 11:44:38 +02:00
opt-dist Remove valgrind test suite from opt-dist 2024-10-07 07:54:57 +00:00
remote-test-client
remote-test-server
replace-version-placeholder
rls
run-make-support Dynamically link run-make support 2024-10-27 14:56:35 +00:00
rust-analyzer rust-analyzer: Rename LayoutS to LayoutData 2024-10-27 22:32:58 -07:00
rust-installer Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
rustbook Update rustbook to support new test linking in reference 2024-10-23 11:44:23 -07:00
rustc-perf@d5055e7804
rustc-perf-wrapper
rustdoc
rustdoc-gui Enable --no-sandbox option by default for rustdoc GUI tests 2024-10-04 12:11:23 +02:00
rustdoc-gui-test
rustdoc-js Separate core search logic with search ui 2024-08-29 00:26:16 +08:00
rustdoc-themes Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
rustfmt Rewrite for<..> async correctly 2024-10-15 10:22:03 -04:00
suggest-tests Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
tidy tests/run-make: port issue-84395-lto-embed-bitcode to rmake.rs 2024-10-22 19:43:22 +08:00
tier-check
unicode-table-generator Rollup merge of #131647 - jieyouxu:unicode-table-generator, r=Mark-Simulacrum 2024-10-20 16:54:09 +02:00
unstable-book-gen Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
wasm-component-ld Update wasm-component-ld to 0.5.10 2024-10-09 13:21:00 -07:00
x
cherry-pick.sh
publish_toolstate.py Resolved python deprecation warning in publish_toolstate.py 2024-10-14 15:27:37 -04:00