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

factor out pluralisation remains after #64280 #64342

Merged
merged 1 commit into from
Sep 21, 2019
Merged

Conversation

glorv
Copy link
Contributor

@glorv glorv commented Sep 10, 2019

there are two case that doesn't not match the original macro pattern at here and here as the provided param is already a bool or the check condition is not x != 1, so I change the macro accept a boolean expr instead of number to fit all the cases.

@Centril please review

Fixes #64238.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @estebank (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 10, 2019
Copy link
Member

@varkor varkor left a comment

Choose a reason for hiding this comment

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

@glorv: thanks for the pull request! Instead of adding another variant to the macro, I would instead use the original macro and refactor the methods that have a plural: bool. E.g.
https://github.com/rust-lang/rust/blob/5608ea6277e6ab5421318068c47647a289d83d82/src/librustc_lint/unused.rs#L254
could pass len instead of true and then pluralise! could be used as normal.

@@ -36,6 +36,8 @@ use log::*;
use crate::extract_gdb_version;
use crate::is_android_gdb_target;

use syntax::errors::pluralise;
Copy link
Member

Choose a reason for hiding this comment

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

You can't use syntax here: I might just leave this one as is.

@varkor
Copy link
Member

varkor commented Sep 10, 2019

r? @varkor

@rust-highfive rust-highfive assigned varkor and unassigned estebank Sep 10, 2019
@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@glorv glorv force-pushed the master branch 3 times, most recently from 18b7ef5 to 966fe50 Compare September 11, 2019 02:59
@Alexendoo
Copy link
Member

Ping from triage, any updates? @varkor

src/librustc_errors/lib.rs Outdated Show resolved Hide resolved
@varkor
Copy link
Member

varkor commented Sep 18, 2019

@glorv: sorry, I didn't notice that you had pushed new changes. I think you want to keep the macro definition as-is: you should just be passing an integer to it. You'll just need to do some refactoring around the locations where there's a boolean value.

@glorv
Copy link
Contributor Author

glorv commented Sep 19, 2019

@varkor @estebank thanks for the review and comments. I change the macro back to the origin format and refactor the effected code, please have another review about that.

@rust-highfive

This comment has been minimized.

@glorv glorv force-pushed the master branch 5 times, most recently from 70c695a to 20dc4e0 Compare September 19, 2019 07:13
@rust-highfive

This comment has been minimized.

@glorv glorv force-pushed the master branch 2 times, most recently from 7dd1570 to 93d8eb0 Compare September 19, 2019 16:02
@rust-highfive

This comment has been minimized.

@varkor
Copy link
Member

varkor commented Sep 19, 2019

@glorv: this all looks good to me! Thanks for your patience!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Sep 19, 2019

📌 Commit 1ab5593 has been approved by varkor

@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-review Status: Awaiting review from the assignee but also interested parties. labels Sep 19, 2019
Centril added a commit to Centril/rust that referenced this pull request Sep 20, 2019
factor out pluralisation remains after rust-lang#64280

there are two case that doesn't not match the original macro pattern at [here](https://github.com/rust-lang/rust/blob/master/src/librustc_lint/unused.rs#L146) and [here](https://github.com/rust-lang/rust/blob/master/src/libsyntax/parse/diagnostics.rs#L539) as the provided param is already a bool or the check condition is not `x != 1`, so I change the macro accept a boolean expr instead of number to fit all the cases.

@Centril  please review

Fixes rust-lang#64238.
bors added a commit that referenced this pull request Sep 20, 2019
Rollup of 8 pull requests

Successful merges:

 - #64136 (Document From trait for LhsExpr in parser)
 - #64342 (factor out pluralisation remains after #64280)
 - #64387 (Fix redundant semicolon lint interaction with proc macro attributes)
 - #64498 (When possible point at argument causing item obligation failure)
 - #64615 (rustbuild: Turn down compression on exe installers)
 - #64617 (rustbuild: Turn down compression on msi installers)
 - #64618 (rustbuild: Improve output of `dist` step)
 - #64621 (Add Compatibility Notes to RELEASES.md for 1.38.0)

Failed merges:

r? @ghost
Centril added a commit to Centril/rust that referenced this pull request Sep 20, 2019
factor out pluralisation remains after rust-lang#64280

there are two case that doesn't not match the original macro pattern at [here](https://github.com/rust-lang/rust/blob/master/src/librustc_lint/unused.rs#L146) and [here](https://github.com/rust-lang/rust/blob/master/src/libsyntax/parse/diagnostics.rs#L539) as the provided param is already a bool or the check condition is not `x != 1`, so I change the macro accept a boolean expr instead of number to fit all the cases.

@Centril  please review

Fixes rust-lang#64238.
tmandry added a commit to tmandry/rust that referenced this pull request Sep 20, 2019
factor out pluralisation remains after rust-lang#64280

there are two case that doesn't not match the original macro pattern at [here](https://github.com/rust-lang/rust/blob/master/src/librustc_lint/unused.rs#L146) and [here](https://github.com/rust-lang/rust/blob/master/src/libsyntax/parse/diagnostics.rs#L539) as the provided param is already a bool or the check condition is not `x != 1`, so I change the macro accept a boolean expr instead of number to fit all the cases.

@Centril  please review

Fixes rust-lang#64238.
tmandry added a commit to tmandry/rust that referenced this pull request Sep 20, 2019
factor out pluralisation remains after rust-lang#64280

there are two case that doesn't not match the original macro pattern at [here](https://github.com/rust-lang/rust/blob/master/src/librustc_lint/unused.rs#L146) and [here](https://github.com/rust-lang/rust/blob/master/src/libsyntax/parse/diagnostics.rs#L539) as the provided param is already a bool or the check condition is not `x != 1`, so I change the macro accept a boolean expr instead of number to fit all the cases.

@Centril  please review

Fixes rust-lang#64238.
tmandry added a commit to tmandry/rust that referenced this pull request Sep 20, 2019
factor out pluralisation remains after rust-lang#64280

there are two case that doesn't not match the original macro pattern at [here](https://github.com/rust-lang/rust/blob/master/src/librustc_lint/unused.rs#L146) and [here](https://github.com/rust-lang/rust/blob/master/src/libsyntax/parse/diagnostics.rs#L539) as the provided param is already a bool or the check condition is not `x != 1`, so I change the macro accept a boolean expr instead of number to fit all the cases.

@Centril  please review

Fixes rust-lang#64238.
tmandry added a commit to tmandry/rust that referenced this pull request Sep 20, 2019
factor out pluralisation remains after rust-lang#64280

there are two case that doesn't not match the original macro pattern at [here](https://github.com/rust-lang/rust/blob/master/src/librustc_lint/unused.rs#L146) and [here](https://github.com/rust-lang/rust/blob/master/src/libsyntax/parse/diagnostics.rs#L539) as the provided param is already a bool or the check condition is not `x != 1`, so I change the macro accept a boolean expr instead of number to fit all the cases.

@Centril  please review

Fixes rust-lang#64238.
tmandry added a commit to tmandry/rust that referenced this pull request Sep 21, 2019
factor out pluralisation remains after rust-lang#64280

there are two case that doesn't not match the original macro pattern at [here](https://github.com/rust-lang/rust/blob/master/src/librustc_lint/unused.rs#L146) and [here](https://github.com/rust-lang/rust/blob/master/src/libsyntax/parse/diagnostics.rs#L539) as the provided param is already a bool or the check condition is not `x != 1`, so I change the macro accept a boolean expr instead of number to fit all the cases.

@Centril  please review

Fixes rust-lang#64238.
Centril added a commit to Centril/rust that referenced this pull request Sep 21, 2019
factor out pluralisation remains after rust-lang#64280

there are two case that doesn't not match the original macro pattern at [here](https://github.com/rust-lang/rust/blob/master/src/librustc_lint/unused.rs#L146) and [here](https://github.com/rust-lang/rust/blob/master/src/libsyntax/parse/diagnostics.rs#L539) as the provided param is already a bool or the check condition is not `x != 1`, so I change the macro accept a boolean expr instead of number to fit all the cases.

@Centril  please review

Fixes rust-lang#64238.
Centril added a commit to Centril/rust that referenced this pull request Sep 21, 2019
factor out pluralisation remains after rust-lang#64280

there are two case that doesn't not match the original macro pattern at [here](https://github.com/rust-lang/rust/blob/master/src/librustc_lint/unused.rs#L146) and [here](https://github.com/rust-lang/rust/blob/master/src/libsyntax/parse/diagnostics.rs#L539) as the provided param is already a bool or the check condition is not `x != 1`, so I change the macro accept a boolean expr instead of number to fit all the cases.

@Centril  please review

Fixes rust-lang#64238.
bors added a commit that referenced this pull request Sep 21, 2019
Rollup of 9 pull requests

Successful merges:

 - #64010 (Stabilize `param_attrs` in Rust 1.39.0)
 - #64136 (Document From trait for LhsExpr in parser)
 - #64342 (factor out pluralisation remains after #64280)
 - #64347 (Add long error explanation for E0312)
 - #64621 (Add Compatibility Notes to RELEASES.md for 1.38.0)
 - #64632 (remove the extra comma after the match arm)
 - #64640 (No home directory on vxWorks)
 - #64641 (Exempt extern "Rust" from improper_ctypes)
 - #64642 (Fix the span used to suggest avoiding for-loop moves)

Failed merges:

r? @ghost
@bors bors merged commit 1ab5593 into rust-lang:master Sep 21, 2019
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Factor out pluralisation checks in diagnostics
6 participants