Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce must_use on associated types and RPITITs that have a must-use trait in bounds #118504

Merged
merged 1 commit into from
Dec 7, 2023

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Dec 1, 2023

Warn when an RPITIT or (un-normalized) associated type with a #[must_use] trait in its bounds is unused.

This is pending T-lang approval, since it changes the semantics of the #[must_use] attribute slightly, but I think it strictly catches more strange errors.

I could also limit this to just RPITITs, but that seems less useful.

Fixes #118444

@compiler-errors compiler-errors added the I-lang-nominated Nominated for discussion during a lang team meeting. label Dec 1, 2023
@rustbot
Copy link
Collaborator

rustbot commented Dec 1, 2023

r? @WaffleLapkin

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 1, 2023
@compiler-errors compiler-errors added S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 1, 2023
Copy link
Member

@WaffleLapkin WaffleLapkin left a comment

Choose a reason for hiding this comment

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

r=me with T-lang approval

@joshtriplett
Copy link
Member

We discussed this in today's @rust-lang/lang meeting and agreed that this seemed like a clearly correct bugfix. Ship it.

@joshtriplett
Copy link
Member

@bors r=WaffleLapkin

@bors
Copy link
Contributor

bors commented Dec 6, 2023

📌 Commit d1009a4 has been approved by WaffleLapkin

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). labels Dec 6, 2023
@traviscross
Copy link
Contributor

@rustbot labels -I-lang-nominated

As joshtriplett said, the consensus was to do this. Removing the nomination.

@rustbot rustbot removed the I-lang-nominated Nominated for discussion during a lang team meeting. label Dec 6, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 6, 2023
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#117981 (Remove deprecated `--check-cfg` syntax)
 - rust-lang#118177 (Suppress warnings in LLVM wrapper when targeting MSVC)
 - rust-lang#118317 (tip for define macro name after `macro_rules!`)
 - rust-lang#118504 (Enforce `must_use` on associated types and RPITITs that have a must-use trait in bounds)
 - rust-lang#118660 (rustc_arena: add `alloc_str`)
 - rust-lang#118681 (Fix is_foreign_item for StableMIR instance )

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 1b391d4 into rust-lang:master Dec 7, 2023
11 checks passed
@rustbot rustbot added this to the 1.76.0 milestone Dec 7, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 7, 2023
Rollup merge of rust-lang#118504 - compiler-errors:must-use, r=WaffleLapkin

Enforce `must_use` on associated types and RPITITs that have a must-use trait in bounds

Warn when an RPITIT or (un-normalized) associated type with a `#[must_use]` trait in its bounds is unused.

This is pending T-lang approval, since it changes the semantics of the `#[must_use]` attribute slightly, but I think it strictly catches more strange errors.

I could also limit this to just RPITITs, but that seems less useful.

Fixes rust-lang#118444
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

missing unused_must_use for RPITIT
6 participants