rust/tests
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
..
assembly Auto merge of #132079 - fmease:rollup-agrd358, r=fmease 2024-10-23 22:28:57 +00:00
auxiliary
codegen Rollup merge of #130225 - adetaylor:rename-old-receiver, r=wesleywiser 2024-10-24 14:19:53 +11:00
codegen-units
coverage Dont ICE when computing coverage of synthetic async closure body 2024-10-18 20:14:02 +11:00
coverage-run-rustdoc
crashes Rollup merge of #132214 - fmease:mv-impl-trait-val-paths, r=compiler-errors 2024-10-27 19:49:07 +01:00
debuginfo Auto merge of #123550 - GnomedDev:remove-initial-arc, r=Noratrieb 2024-10-24 13:35:50 +00:00
incremental Bless incremental tests. 2024-10-04 23:50:01 +00:00
mir-opt Rollup merge of #130350 - RalfJung:strict-provenance, r=dtolnay 2024-10-21 18:11:19 +02:00
pretty Add pretty, ui, and feature-gate tests for the enzyme/autodiff frontend 2024-10-11 20:38:43 +02:00
run-make port tests/ui/linkage-attr/framework to run-make 2024-10-27 21:23:28 -04:00
rustdoc Re-do recursive const stability checks 2024-10-25 20:31:40 +02:00
rustdoc-gui Add GUI regression test for doc struct fields margins 2024-10-27 11:26:45 +01:00
rustdoc-js allow type-based search on foreign functions 2024-10-25 12:19:04 -05: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 Rename Receiver -> LegacyReceiver 2024-10-22 12:55:16 +00:00
rustdoc-ui Add regression test for #131893 2024-10-24 21:35:15 +02:00
ui Auto merge of #128985 - GrigorenkoPV:instantly-dangling-pointer, r=Urgau 2024-10-29 00:24:07 +00:00
ui-fulldeps give a better error for tuple structs in derive(Diagnostic) 2024-10-27 21:23:28 -04:00
COMPILER_TESTS.md