rust/tests
bors a932eb36f8 Auto merge of #123239 - Urgau:dangerous_implicit_autorefs, r=jdonszelmann,traviscross
Implement a lint for implicit autoref of raw pointer dereference - take 2

*[t-lang nomination comment](https://github.com/rust-lang/rust/pull/123239#issuecomment-2727551097)*

This PR aims at implementing a lint for implicit autoref of raw pointer dereference, it is based on #103735 with suggestion and improvements from https://github.com/rust-lang/rust/pull/103735#issuecomment-1370420305.

The goal is to catch cases like this, where the user probably doesn't realise it just created a reference.

```rust
pub struct Test {
    data: [u8],
}

pub fn test_len(t: *const Test) -> usize {
    unsafe { (*t).data.len() }  // this calls <[T]>::len(&self)
}
```

Since #103735 already went 2 times through T-lang, where they T-lang ended-up asking for a more restricted version (which is what this PR does), I would prefer this PR to be reviewed first before re-nominating it for T-lang.

----

Compared to the PR it is as based on, this PR adds 3 restrictions on the outer most expression, which must either be:
   1. A deref followed by any non-deref place projection (that intermediate deref will typically be auto-inserted)
   2. A method call annotated with `#[rustc_no_implicit_refs]`.
   3. A deref followed by a `addr_of!` or `addr_of_mut!`. See bottom of post for details.

There are several points that are not 100% clear to me when implementing the modifications:
 - ~~"4. Any number of automatically inserted deref/derefmut calls." I as never able to trigger this. Am I missing something?~~ Fixed
 - Are "index" and "field" enough?

----

cc `@JakobDegen` `@WaffleLapkin`
r? `@RalfJung`

try-job: dist-various-1
try-job: dist-various-2
2025-04-28 08:25:23 +00:00
..
assembly Rollup merge of #140194 - jieyouxu:minicore-force-unwind-tables, r=bjorn3 2025-04-24 11:40:42 +02:00
auxiliary stabilize naked_functions 2025-04-20 11:18:38 +02:00
codegen Rollup merge of #139700 - EnzymeAD:autodiff-flags, r=oli-obk 2025-04-24 17:19:44 +02:00
codegen-units Remove -Zinline-in-all-cgus and clean up CGU partitioning tests 2025-01-27 23:48:47 -05:00
coverage Update the minimum external LLVM to 19 2025-04-05 11:44:38 -07:00
coverage-run-rustdoc Update coverage-run-rustdoc output 2025-03-28 10:35:53 +01:00
crashes Rollup merge of #140021 - compiler-errors:no-deep-norm-ice, r=lcnr 2025-04-21 15:55:58 +00:00
debuginfo Rollup merge of #138599 - adwinwhite:recursive-overflow, r=wesleywiser 2025-04-18 05:17:53 +02:00
incremental UI tests: migrate remaining compile time error-patterns to line annotations 2025-04-13 21:48:53 +03:00
mir-opt Auto merge of #132833 - est31:stabilize_let_chains, r=fee1-dead 2025-04-22 07:54:10 +00:00
pretty Rollup merge of #140280 - nnethercote:improve-if-else-printing, r=Urgau 2025-04-27 16:08:59 +02:00
run-make Rollup merge of #140152 - xizheyin:issue-140102, r=jieyouxu 2025-04-25 17:31:47 +02:00
rustdoc Rollup merge of #137096 - ehuss:stabilize-doctest-xcompile, r=fmease 2025-04-25 00:53:58 +02:00
rustdoc-gui Add/update GUI test for impl indent fix 2025-04-24 12:33:29 +02:00
rustdoc-js rustdoc-search: add unbox flag to Result aliases 2025-04-11 11:36:40 -07:00
rustdoc-js-std rustdoc-search: add unbox flag to Result aliases 2025-04-11 11:36:40 -07:00
rustdoc-json Rollup merge of #140076 - aDotInTheVoid:jsondocline, r=GuillaumeGomez 2025-04-21 18:53:19 +00:00
rustdoc-ui Add rustdoc-ui regression test for #140289 2025-04-25 15:55:54 +02:00
ui Auto merge of #123239 - Urgau:dangerous_implicit_autorefs, r=jdonszelmann,traviscross 2025-04-28 08:25:23 +00:00
ui-fulldeps Refactor StableMir to avoid some clones. 2025-04-24 11:12:34 +10:00
COMPILER_TESTS.md