rust/tests
Matthias Krüger 7e0721b798
Rollup merge of #143519 - mu001999-contrib:dead-code/impl-items, r=petrochenkov
Check assoc consts and tys later like assoc fns

This PR
1. checks assoc consts and tys later like assoc fns
2. marks assoc consts appear in poly-trait-ref live

For assoc consts, considering
```rust
#![deny(dead_code)]

trait Tr { // ERROR trait `Tr` is never used
    const I: Self;
}

struct Foo; //~ ERROR struct `Foo` is never constructed

impl Tr for Foo {
    const I: Self = Foo;
}

fn main() {}
```

Current this will produce unused `I` instead of unused `Tr` and `Foo` ([play](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=e0490d4a2d522cb70437b26e514a3d9c)), because `const I: Self = Foo;` will be added into the worklist at first:
```
error: associated constant `I` is never used
 --> src/main.rs:4:11
  |
3 | trait Tr { // ERROR trait `Tr` is never used
  |       -- associated constant in this trait
4 |     const I: Self;
  |           ^
  |
note: the lint level is defined here
 --> src/main.rs:1:9
  |
1 | #![deny(dead_code)]
  |         ^^^^^^^^^

error: could not compile `playground` (bin "playground") due to 1 previous error
```

This also happens to assoc tys, see the [new test](https://github.com/rust-lang/rust/compare/master...mu001999-contrib:rust:dead-code/impl-items?expand=1#diff-bf45fa403934a31c9d610a073ed2603d885e7e81572e8edf38b7f4e08a1f3531)

Fixes rust-lang/rust#126729

r? `````@petrochenkov`````
2025-07-13 15:15:57 +02:00
..
assembly emit .att_syntax when global/naked asm use that option 2025-07-09 01:09:55 +02:00
auxiliary minicore: use core's diagnostic::on_unimplemented messages 2025-07-03 10:22:40 +02:00
codegen Rollup merge of #143718 - scottmcm:ub-transmute-is-ub, r=WaffleLapkin 2025-07-11 07:35:22 +02:00
codegen-units Auto merge of #142893 - Mark-Simulacrum:no-const-collect, r=oli-obk 2025-06-27 12:57:05 +00:00
coverage Remove let_chains feature 2025-06-30 07:49:20 -05:00
coverage-run-rustdoc
crashes Remove support for dyn* 2025-07-01 19:00:21 +00:00
debuginfo tests: {Meta,Pointee}Sized in non-minicore tests 2025-06-16 23:04:33 +00:00
incremental Stop requiring HIR for trait item wf checks 2025-06-30 08:45:43 +00:00
mir-opt Propagate from borrowed locals in CopyProp 2025-07-10 09:36:20 +02:00
pretty Rewrite empty attribute lint 2025-07-06 09:51:35 +02:00
run-make Fix std debug assertions gate in fmt-write-boat 2025-07-11 20:01:42 +08:00
rustdoc Add regression test for #143107 2025-07-10 11:41:50 +02:00
rustdoc-gui Update rustdoc GUI tests 2025-07-01 15:49:45 +02:00
rustdoc-js Migrate some tests away from concat-idents 2025-06-24 10:54:54 +00:00
rustdoc-js-std add doc(alias("AsciiChar")) to core::ascii::Char 2025-06-20 11:11:51 -05:00
rustdoc-json fix typos in function names in the target_feature test 2025-07-11 02:27:39 +03:00
rustdoc-ui refactor: Make -Ztrack-diagnostics emit like a note 2025-07-03 07:19:25 -06:00
ui Rollup merge of #143519 - mu001999-contrib:dead-code/impl-items, r=petrochenkov 2025-07-13 15:15:57 +02:00
ui-fulldeps Expose nested bodies in rustc_borrowck::consumers 2025-07-08 19:09:14 -07:00
COMPILER_TESTS.md