Skip to content

Conversation

@mu001999
Copy link
Contributor

@mu001999 mu001999 commented Feb 5, 2026

Fixes #44232
Fixes #151752

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 5, 2026
@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is neat! in the future, it would be easier to review if you split the rename into a separate commit from the change in behavior.

could you add some tests for this please?

View changes since this review

@mu001999 mu001999 force-pushed the lint/unused_features branch 2 times, most recently from cb9b84c to cd83e12 Compare February 5, 2026 15:31
@mu001999
Copy link
Contributor Author

mu001999 commented Feb 5, 2026

Initial implementation completed. I plan to add more tests and check whether features in rustc are reported as unused correctly or not.

@rust-log-analyzer

This comment has been minimized.

@mu001999 mu001999 force-pushed the lint/unused_features branch from cd83e12 to 2945856 Compare February 6, 2026 00:38
@rust-log-analyzer

This comment has been minimized.

@mu001999 mu001999 force-pushed the lint/unused_features branch from 2945856 to 36c0a20 Compare February 6, 2026 01:00
@rust-log-analyzer

This comment has been minimized.

@mu001999 mu001999 force-pushed the lint/unused_features branch from 36c0a20 to 2ddaf82 Compare February 7, 2026 01:16
@rust-log-analyzer

This comment has been minimized.

@mu001999 mu001999 force-pushed the lint/unused_features branch from 2ddaf82 to fb08c95 Compare February 7, 2026 11:37
@rust-log-analyzer

This comment has been minimized.

@mu001999 mu001999 force-pushed the lint/unused_features branch from fb08c95 to 38aefe4 Compare February 7, 2026 12:45
@rust-log-analyzer

This comment has been minimized.

@mu001999 mu001999 force-pushed the lint/unused_features branch from 38aefe4 to 0cda8d4 Compare February 7, 2026 13:35
@rust-log-analyzer

This comment has been minimized.

@mu001999 mu001999 force-pushed the lint/unused_features branch from 0cda8d4 to 2d2577f Compare February 7, 2026 14:19
@rust-log-analyzer

This comment has been minimized.

@mu001999 mu001999 force-pushed the lint/unused_features branch from 2d2577f to b67632e Compare February 7, 2026 15:08
@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@mu001999 mu001999 force-pushed the lint/unused_features branch 2 times, most recently from a940d65 to 435090a Compare February 8, 2026 02:11
@mu001999 mu001999 force-pushed the lint/unused_features branch 2 times, most recently from 84b5565 to c189c97 Compare February 12, 2026 14:46
@rust-log-analyzer

This comment has been minimized.

self.enabled_lang_features().hash_stable(hcx, hasher);
self.enabled_lib_features().hash_stable(hcx, hasher);
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still necessary with the no_hash?

Copy link
Contributor Author

@mu001999 mu001999 Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been removed in the third commit. Let me squash these two commits.

@mu001999 mu001999 force-pushed the lint/unused_features branch 2 times, most recently from 4ba23c6 to acb3115 Compare February 12, 2026 15:16
@rust-log-analyzer

This comment has been minimized.

@mu001999 mu001999 force-pushed the lint/unused_features branch from acb3115 to 1875ae8 Compare February 12, 2026 15:50
@rust-log-analyzer

This comment has been minimized.

@mu001999 mu001999 force-pushed the lint/unused_features branch from 1875ae8 to 382a5fe Compare February 12, 2026 16:46
@rust-log-analyzer

This comment has been minimized.

@mu001999
Copy link
Contributor Author

mu001999 commented Feb 12, 2026

Some incremental tests failed because query features will be always dirty. And some of these have expired with current implementation. For now, I just update them to fit the new result directly. Expired ones should be removed if current implementation is accepted finally.

@rust-log-analyzer

This comment has been minimized.

@mu001999 mu001999 force-pushed the lint/unused_features branch from 5551df6 to b807143 Compare February 13, 2026 01:24
@mu001999 mu001999 force-pushed the lint/unused_features branch from b807143 to 9b6aa0d Compare February 13, 2026 01:48
@rust-log-analyzer

This comment has been minimized.

@mu001999 mu001999 force-pushed the lint/unused_features branch from 9b6aa0d to 2d0bb85 Compare February 13, 2026 03:16
@rust-log-analyzer

This comment has been minimized.

@mu001999 mu001999 force-pushed the lint/unused_features branch from 2d0bb85 to 8fc6deb Compare February 13, 2026 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rustc could warn if a feature is unused Re-enable detection of unused library #![feature] directives

6 participants