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

Extend the `#[must_use]` lint to arrays #62235

Merged
merged 5 commits into from Jul 1, 2019

Conversation

Projects
None yet
4 participants
@varkor
Copy link
Member

commented Jun 29, 2019

Based on top of #62228.

r? @Centril

Show resolved Hide resolved src/librustc_lint/unused.rs Outdated
Show resolved Hide resolved src/librustc_lint/unused.rs
@Centril

This comment has been minimized.

Copy link
Member

commented Jun 29, 2019

r=me with CI passing, the first nit fixed, and optionally the second.

@rust-lang/lang N.B. This PR extends #[must_use] to arrays. I believe this should be uncontroversial given #61100 and our approval of that given that an array can be viewed as a sort of homogeneous tuple type. Arrays are also structural-ish.

@varkor varkor force-pushed the varkor:must_use-adt-components branch from ffc5bf7 to 0fccbf0 Jun 29, 2019

@varkor

This comment has been minimized.

Copy link
Member Author

commented Jun 29, 2019

@bors r=Centril

@bors

This comment has been minimized.

Copy link
Contributor

commented Jun 29, 2019

📌 Commit 0fccbf0 has been approved by Centril

Centril added a commit to Centril/rust that referenced this pull request Jun 29, 2019

Rollup merge of rust-lang#62235 - varkor:must_use-adt-components, r=C…
…entril

Extend the `#[must_use]` lint to arrays

Based on top of rust-lang#62228.

r? @Centril

bors added a commit that referenced this pull request Jun 29, 2019

Auto merge of #62242 - Centril:rollup-wuprmbu, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #61767 (Update new_debug_unreachable)
 - #62128 (Adjust warning of -C extra-filename with -o.)
 - #62224 (rustdoc: remove unused derives and variants)
 - #62235 (Extend the `#[must_use]` lint to arrays)
 - #62239 (Fix a typo)

Failed merges:

r? @ghost
@Centril

This comment has been minimized.

Copy link
Member

commented Jun 30, 2019

@bors r- ; seems we have a toolstate failure in #62242 (comment).

@varkor

This comment has been minimized.

Copy link
Member Author

commented Jun 30, 2019

This will be fixed once rust-lang/miri#806 is merged.

@Centril

This comment has been minimized.

Copy link
Member

commented Jun 30, 2019

r=me then :)

@varkor

This comment has been minimized.

Copy link
Member Author

commented Jun 30, 2019

@bors r=Centril

@bors

This comment has been minimized.

Copy link
Contributor

commented Jun 30, 2019

📌 Commit 0fccbf0 has been approved by Centril

@varkor varkor force-pushed the varkor:must_use-adt-components branch from 0fccbf0 to 76f5b50 Jun 30, 2019

@varkor

This comment has been minimized.

Copy link
Member Author

commented Jun 30, 2019

@bors r=Centril

@bors

This comment has been minimized.

Copy link
Contributor

commented Jun 30, 2019

📌 Commit 76f5b50 has been approved by Centril

Centril added a commit to Centril/rust that referenced this pull request Jun 30, 2019

Rollup merge of rust-lang#62235 - varkor:must_use-adt-components, r=C…
…entril

Extend the `#[must_use]` lint to arrays

Based on top of rust-lang#62228.

r? @Centril

bors added a commit that referenced this pull request Jul 1, 2019

Auto merge of #62253 - Centril:rollup-115uuuq, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #62062 (Use a more efficient iteration order for forward dataflow)
 - #62063 (Use a more efficient iteration order for backward dataflow)
 - #62224 (rustdoc: remove unused derives and variants)
 - #62228 (Extend the #[must_use] lint to boxed types)
 - #62235 (Extend the `#[must_use]` lint to arrays)
 - #62239 (Fix a typo)
 - #62241 (Always parse 'async unsafe fn' + properly ban in 2015)
 - #62248 (before_exec actually will only get deprecated with 1.37)

Failed merges:

r? @ghost

@bors bors merged commit 76f5b50 into rust-lang:master Jul 1, 2019

1 check passed

pr Build #20190630.21 succeeded
Details

@Centril Centril added this to the 1.37 milestone Jul 1, 2019

bors added a commit that referenced this pull request Jul 22, 2019

Auto merge of #62262 - varkor:must_use-adt-components-ii, r=<try>
Extend `#[must_use]` to nested structures

Extends the `#[must_use]` lint to apply when `#[must_use]` types are nested within `struct`s (or one-variant `enum`s), making the lint much more generally useful. This is in line with #61100 extending the lint to tuples.

Fixes #39524.

cc @rust-lang/lang and @rust-lang/compiler for discussion in case this is a controversial change. In particular, we might want to consider allowing annotations on fields containing `#[must_use]` types in user-defined types (e.g. `#[allow(unused_must_use)]`) to opt out of this behaviour, if there are cases where we this this is likely to have frequent false positives.

(This is based on top of #62235.)

bors added a commit that referenced this pull request Jul 22, 2019

Auto merge of #62262 - varkor:must_use-adt-components-ii, r=<try>
Extend `#[must_use]` to nested structures

Extends the `#[must_use]` lint to apply when `#[must_use]` types are nested within `struct`s (or one-variant `enum`s), making the lint much more generally useful. This is in line with #61100 extending the lint to tuples.

Fixes #39524.

cc @rust-lang/lang and @rust-lang/compiler for discussion in case this is a controversial change. In particular, we might want to consider allowing annotations on fields containing `#[must_use]` types in user-defined types (e.g. `#[allow(unused_must_use)]`) to opt out of this behaviour, if there are cases where we this this is likely to have frequent false positives.

(This is based on top of #62235.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.