summary refs log tree commit diff
path: root/tests/ui/lint/dead-code
AgeCommit message (Collapse)AuthorLines
2024-08-03Bless test falloutMichael Goulet-4/+8
2024-08-03Revert "Rollup merge of #125572 - mu001999-contrib:dead/enhance, r=pnkfelix"Michael Goulet-119/+10
This reverts commit 13314df21b0bb0cdd02c6760581d1b9f1052fa7e, reversing changes made to 6e534c73c35f569492ed5fb5f349075d58ed8b7e.
2024-08-03Revert "Rollup merge of #126315 - mu001999-contrib:fix/126289, r=petrochenkov"Michael Goulet-33/+0
This reverts commit 977c5fd419ade52467f7de79d5bfc25c0c893275, reversing changes made to 24c94f0e4f5aa333c665fbbba423172c30176624.
2024-08-03Revert "Rollup merge of #126618 - mu001999-contrib:dead/enhance, r=pnkfelix"Michael Goulet-31/+0
This reverts commit 2724aeaaeb127a8073e39461caacbe21a128ce7b, reversing changes made to d929a42a664c026167800801b26d734db925314f.
2024-08-03Revert "Rollup merge of #127107 - mu001999-contrib:dead/enhance-2, r=pnkfelix"Michael Goulet-135/+18
This reverts commit 31fe9628cf830a08e7194a446f66c668aaea86e9, reversing changes made to f20307851ead9fbbb9fa88bbffb3258a069230a6.
2024-08-03Revert "Rollup merge of #127017 - mu001999-contrib:dead/enhance, r=pnkfelix"Michael Goulet-65/+0
This reverts commit a70dc297a899b76793a14c5705f6ec78fd7a57a7, reversing changes made to ceae37188b9f1be527bb16c9d657a161be7dbbe3.
2024-08-03Revert "Rollup merge of #128104 - mu001999-contrib:fix/128053, r=petrochenkov"Michael Goulet-49/+0
This reverts commit 91b18a058c4661f82e420b633dc0a3e1ccd14b88, reversing changes made to 9aedec9313dc8ecf9bdcb5f09c4eb0ad8b9a4875.
2024-07-29Rollup merge of #128284 - GKFX:stabilize-offset-of-nested, r=dtolnay,jieyouxuMatthias Krüger-8/+6
Stabilize offset_of_nested Tracking issue #120140. Closes #120140. As the FCP is now nearing its end I have opened a stabilization PR. I have done this separately to the offset_of_enum feature, since that FCP has not started. `@rustbot` label F-offset_of_nested T-lang T-libs-api
2024-07-29Stabilize offset_of_nestedGeorge Bateman-8/+6
2024-07-26Not lint pub structs without pub constructors if containing fields of unit, ↵mu001999-0/+49
never type, PhantomData and positional ZST
2024-07-26Rollup merge of #127017 - mu001999-contrib:dead/enhance, r=pnkfelixTrevor Gross-0/+65
Extend rules of dead code analysis for impls for adts to impls for types refer to adts The rules of dead code analysis for impl blocks can be extended to self types which refer to adts. So that we can lint the following unused struct and trait: ```rust struct Foo; //~ ERROR struct `Foo` is never constructed trait Trait { //~ ERROR trait `Trait` is never used fn foo(&self) {} } impl Trait for &Foo {} ``` r? `@pnkfelix`
2024-07-05Rollup merge of #127107 - mu001999-contrib:dead/enhance-2, r=pnkfelixMichael Goulet-18/+135
Improve dead code analysis Fixes #120770 1. check impl items later if self ty is private although the trait method is public, cause we must use the ty firstly if it's private 2. mark the adt live if it appears in pattern, like generic argument, this implies the use of the adt 3. based on the above, we can handle the case that private adts impl Default, so that we don't need adding rustc_trivial_field_reads on Default, and the logic in should_ignore_item r? ``@pnkfelix``
2024-07-04Improve dead code analysismu001999-18/+135
2024-06-27Extend rules of dead code analysis for impls for adts to impls for types ↵mu001999-0/+65
refer to adts
2024-06-26Auto merge of #120924 - xFrednet:rfc-2383-stabilization-party, r=Urgau,blyxyasbors-5/+2
Let's `#[expect]` some lints: Stabilize `lint_reasons` (RFC 2383) Let's give this another try! The [previous stabilization attempt](https://github.com/rust-lang/rust/pull/99063) was stalled by some unresolved questions. These have been discussed in a [lang team](https://github.com/rust-lang/lang-team/issues/191) meeting. The last open question, regarding the semantics of the `#[expect]` attribute was decided on in https://github.com/rust-lang/rust/issues/115980 I've just updated the [stabilization report](https://github.com/rust-lang/rust/issues/54503#issuecomment-1179563964) with the discussed questions and decisions. Luckily, the decision is inline with the current implementation. This hopefully covers everything. Let's hope that the CI will be green like the spring. fixes #115980 fixes #54503 --- r? `@wesleywiser` Tacking Issue: https://github.com/rust-lang/rust/issues/54503 Stabilization Report: https://github.com/rust-lang/rust/issues/54503#issuecomment-1179563964 Documentation Update: https://github.com/rust-lang/reference/pull/1237 <!-- For Clippy: changelog: [`allow_attributes`]: Is now available on stable, since the `lint_reasons` feature was stabilized changelog: [`allow_attributes_without_reason`]: Is now available on stable, since the `lint_reasons` feature was stabilized --> --- Roses are red, Violets are blue, Let's expect lints, With reason clues
2024-06-25Auto merge of #126951 - matthiaskrgr:rollup-xg0o4mc, r=matthiaskrgrbors-0/+31
Rollup of 7 pull requests Successful merges: - #126618 (Mark assoc tys live only if the corresponding trait is live) - #126746 (Deny `use<>` for RPITITs) - #126868 (not use offset when there is not ends with brace) - #126884 (Do not ICE when suggesting dereferencing closure arg) - #126893 (Eliminate the distinction between PREC_POSTFIX and PREC_PAREN precedence level) - #126915 (Don't suggest awaiting in closure patterns) - #126943 (De-duplicate all consecutive native libs regardless of their options) r? `@ghost` `@rustbot` modify labels: rollup
2024-06-25Rollup merge of #126302 - mu001999-contrib:ignore/default, r=michaelwoeristerMatthias Krüger-0/+49
Detect unused structs which derived Default <!-- If this PR is related to an unstable feature or an otherwise tracked effort, please link to the relevant tracking issue here. If you don't know of a related tracking issue or there are none, feel free to ignore this. This PR will get automatically assigned to a reviewer. In case you would like a specific user to review your work, you can assign it to them by using r​? <reviewer name> --> Fixes #98871
2024-06-25Rollup merge of #126618 - mu001999-contrib:dead/enhance, r=pnkfelixMatthias Krüger-0/+31
Mark assoc tys live only if the corresponding trait is live r? ````@pnkfelix````
2024-06-25Detect unused structs which derived Defaultmu001999-0/+49
2024-06-25RFC 2383: Stabilize `lint_reasons` :tada:xFrednet-5/+2
2024-06-24Rollup merge of #124460 - long-long-float:show-notice-about-enum-with-debug, ↵Michael Goulet-1/+36
r=pnkfelix Show notice about "never used" of Debug for enum Close #123068 If an ADT implements `Debug` trait and it is not used, the compiler says a note that indicates intentionally ignored during dead code analysis as [this note](https://github.com/rust-lang/rust/blob/2207179a591f5f252885a94ab014dafeb6e8e9e8/tests/ui/lint/dead-code/unused-variant.stderr#L9). However this node is not shown for variants that have fields in enum. This PR fixes to show the note.
2024-06-19Rollup merge of #124580 - gurry:124556-suggest-remove-tuple-field, r=jackh726León Orell Valerian Liehr-26/+42
Suggest removing unused tuple fields if they are the last fields Fixes #124556 We now check if dead/unused fields are the last fields of the tuple and suggest their removal instead of suggesting them to be changed to `()`.
2024-06-18Mark assoc tys live only if the trait is livemu001999-0/+31
2024-06-16Show notice about "never used" for enumlong-long-float-1/+36
2024-06-13Rollup merge of #126315 - mu001999-contrib:fix/126289, r=petrochenkovMatthias Krüger-0/+33
Add pub struct with allow(dead_code) into worklist <!-- If this PR is related to an unstable feature or an otherwise tracked effort, please link to the relevant tracking issue here. If you don't know of a related tracking issue or there are none, feel free to ignore this. This PR will get automatically assigned to a reviewer. In case you would like a specific user to review your work, you can assign it to them by using r​? <reviewer name> --> Fixes #126289
2024-06-12Detect pub structs never constructed even though they impl pub trait with ↵r0cky-0/+78
assoc constants
2024-06-12Add pub struct with allow(dead_code) into worklistr0cky-0/+33
2024-06-05Detect pub structs never constructed and unused associated constants in traitsr0cky-10/+119
2024-05-23Detect unused structs which implement private traitsr0cky-0/+48
2024-05-13Suggest removing unused tuple fields if they are the last fieldsGurinder Singh-26/+42
2024-03-12Replace visibility test with reachability test in dead code detectionArthur Carcano-0/+27
Fixes https://github.com/rust-lang/rust/issues/119545
2024-03-10Detect unused struct impls pub traitr0cky-4/+31
2024-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-26/+26
2024-02-07Update testsr0cky-11/+5
2024-02-07Make traits / trait methods detected by the dead code lint!r0cky-0/+65
2024-02-01`#![feature(inline_const_pat)]` is no longer incompleteMatthew Jasper-1/+0
2024-01-19Stabilize simple offset_ofGeorge Bateman-2/+2
2024-01-18`dead_code` treats `#[repr(transparent)]` the same as `#[repr(C)]`Jake Goulding-0/+14
Fixes #119659
2024-01-02Adjust compiler tests for unused_tuple_struct_fields -> dead_codeJake Goulding-11/+25
2023-12-25Pass DeadItem and lint as consistent group in dead-code.Camille GILLOT-0/+4
2023-11-24Show number in error message even for one errorNilstrieb-9/+9
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-08-10Respect `#[expect]` the same way `#[allow]` is with the `dead_code` lintUrgau-0/+70
2023-04-21major test improvementsDrMeepster-1/+1
2023-04-21blessDrMeepster-6/+6
2023-04-21fmtDrMeepster-6/+8
2023-04-21fix incorrect param env in dead code lintDrMeepster-0/+134
2023-04-15Unignore closure-bang.Eric Huss-3/+18
This test was ignored long ago in https://github.com/rust-lang/rust/pull/20578/ when the syntax for closures was changed. The current status is that a closure with an explicit `!` return type will trigger the `unreachable_code` lint which appears to be the original intent of the test (https://github.com/rust-lang/rust/pull/16836). A closure without a return type won't trigger the lint since the `!` type isn't inferred (AFAIK). This restores the test to its original form.
2023-04-13impl reviewer feedbackEzra Shaw-6/+22
- remove unused (pun intentional) `continue` - improve wording with assoc items in general
2023-04-13dead-code-lint: de-dup multiple unused assoc fnsEzra Shaw-55/+40
2023-04-13refactor: emit "unused assoc fn" in lexical orderEzra Shaw-26/+80
with repect to other dead code lints