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

Fix unused_parens triggers on macro by example code #66983

Merged
merged 5 commits into from
Dec 12, 2019

Conversation

weiznich
Copy link
Contributor

@weiznich weiznich commented Dec 3, 2019

Fix #66295

Unfortunately this does also break an existing test. I'm not sure how to handle that, because that seems to be quite similar to the allowed cases

If this gets accepted it would be great to backport this fix to beta.

@rust-highfive
Copy link
Collaborator

r? @estebank

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

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

The job x86_64-gnu-llvm-6.0 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-12-03T11:39:51.5613467Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-12-03T11:39:51.5636206Z ##[command]git config gc.auto 0
2019-12-03T11:39:51.5647122Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-12-03T11:39:51.5651616Z ##[command]git config --get-all http.proxy
2019-12-03T11:39:51.5657768Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/66983/merge:refs/remotes/pull/66983/merge
---
2019-12-03T12:48:50.5483489Z .................................................................................................... 1600/9319
2019-12-03T12:48:55.9462475Z .................................................................................................... 1700/9319
2019-12-03T12:49:10.3675359Z ........................................i........................................................... 1800/9319
2019-12-03T12:49:19.2987339Z .................................................................................................... 1900/9319
2019-12-03T12:49:35.2403917Z .........................iiiii...................................................................... 2000/9319
2019-12-03T12:49:47.1749001Z .................................................................................................... 2200/9319
2019-12-03T12:49:50.1877540Z .................................................................................................... 2300/9319
2019-12-03T12:49:55.5512180Z .................................................................................................... 2400/9319
2019-12-03T12:50:21.1080034Z .................................................................................................... 2500/9319
---
2019-12-03T12:53:29.9822747Z ..........................i...............i......................................................... 4800/9319
2019-12-03T12:53:42.4359196Z .................................................................................................... 4900/9319
2019-12-03T12:53:49.6550006Z .................................................................................................... 5000/9319
2019-12-03T12:53:59.1584453Z .................................................................................................... 5100/9319
2019-12-03T12:54:08.1888167Z ................................ii.ii...........i................................................... 5200/9319
2019-12-03T12:54:19.3159703Z .................................................................................................... 5400/9319
2019-12-03T12:54:31.6291787Z .................................................................................................... 5500/9319
2019-12-03T12:54:40.3698269Z ..............i..................................................................................... 5600/9319
2019-12-03T12:54:48.1165883Z .................................................................................................... 5700/9319
2019-12-03T12:54:48.1165883Z .................................................................................................... 5700/9319
2019-12-03T12:55:01.5272099Z .................................................................................................... 5800/9319
2019-12-03T12:55:15.7995697Z ii...i..ii...........i.............................................................................. 5900/9319
2019-12-03T12:55:37.4331483Z .................................................................................................... 6100/9319
2019-12-03T12:55:46.5923788Z .................................................................................................... 6200/9319
2019-12-03T12:55:46.5923788Z .................................................................................................... 6200/9319
2019-12-03T12:56:03.0382472Z .......................i..ii........................................................................ 6300/9319
2019-12-03T12:56:26.3522930Z ..............................................................................................i..... 6500/9319
2019-12-03T12:56:29.0406047Z .................................................................................................... 6600/9319
2019-12-03T12:56:31.6684016Z .....................................................................................i.............. 6700/9319
2019-12-03T12:56:34.8498785Z .................................................................................................... 6800/9319
---
2019-12-03T13:02:12.5965312Z 
2019-12-03T13:02:12.5965885Z - warning: unnecessary parentheses around function argument
2019-12-03T13:02:12.5966279Z -   --> $DIR/issue-47775-nested-macro-unnecessary-parens-arg.rs:22:83
2019-12-03T13:02:12.5966638Z -    |
2019-12-03T13:02:12.5967040Z - LL |         #[allow(dead_code)] fn the_night_for_the_morrow() -> Option<isize> { Some((2)) }
2019-12-03T13:02:12.5968647Z - ...
2019-12-03T13:02:12.5968647Z - ...
2019-12-03T13:02:12.5969025Z - LL | and_the_heavens_reject_not!();
2019-12-03T13:02:12.5969786Z -    |
2019-12-03T13:02:12.5970141Z - note: lint level defined here
2019-12-03T13:02:12.5970567Z -   --> $DIR/issue-47775-nested-macro-unnecessary-parens-arg.rs:3:9
2019-12-03T13:02:12.5970903Z -    |
2019-12-03T13:02:12.5970903Z -    |
2019-12-03T13:02:12.5971510Z - LL | #![warn(unused_parens)]
2019-12-03T13:02:12.5971886Z -    |         ^^^^^^^^^^^^^
2019-12-03T13:02:12.5972204Z - 
2019-12-03T13:02:12.5972514Z - 
2019-12-03T13:02:12.5972950Z 
2019-12-03T13:02:12.5973072Z 
2019-12-03T13:02:12.5973649Z error: failed to delete `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/lint/issue-47775-nested-macro-unnecessary-parens-arg/issue-47775-nested-macro-unnecessary-parens-arg.stderr`: No such file or directory (os error 2)
2019-12-03T13:02:12.5975792Z [ERROR compiletest::runtest] fatal error, panic: "failed to delete `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/lint/issue-47775-nested-macro-unnecessary-parens-arg/issue-47775-nested-macro-unnecessary-parens-arg.stderr`: No such file or directory (os error 2)"
2019-12-03T13:02:12.5976366Z thread '[ui] ui/lint/issue-47775-nested-macro-unnecessary-parens-arg.rs' panicked at 'fatal error', src/tools/compiletest/src/runtest.rs:2276:9
2019-12-03T13:02:12.5976743Z 
2019-12-03T13:02:12.5976864Z 
2019-12-03T13:02:12.5977025Z failures:
2019-12-03T13:02:12.5978028Z     [ui] ui/lint/issue-47775-nested-macro-unnecessary-parens-arg.rs
2019-12-03T13:02:12.5978028Z     [ui] ui/lint/issue-47775-nested-macro-unnecessary-parens-arg.rs
2019-12-03T13:02:12.5978253Z 
2019-12-03T13:02:12.5978699Z test result: FAILED. 9271 passed; 1 failed; 47 ignored; 0 measured; 0 filtered out
2019-12-03T13:02:12.5978859Z 
2019-12-03T13:02:12.6001098Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:537:22
2019-12-03T13:02:12.6019988Z 
2019-12-03T13:02:13.3185880Z 
2019-12-03T13:02:13.3189608Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
2019-12-03T13:02:13.3190440Z 
2019-12-03T13:02:13.3190570Z 
2019-12-03T13:02:13.3190811Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-12-03T13:02:13.3190989Z Build completed unsuccessfully in 1:15:37
2019-12-03T13:02:13.3190989Z Build completed unsuccessfully in 1:15:37
2019-12-03T13:02:13.3191133Z == clock drift check ==
2019-12-03T13:02:13.3191273Z   local time: Tue Dec  3 13:02:12 UTC 2019
2019-12-03T13:02:13.3191437Z   network time: Tue, 03 Dec 2019 13:02:12 GMT
2019-12-03T13:02:13.3191582Z == end clock drift check ==
2019-12-03T13:02:13.4479979Z 
2019-12-03T13:02:13.4658435Z ##[error]Bash exited with code '1'.
2019-12-03T13:02:13.4732659Z ##[section]Starting: Checkout
2019-12-03T13:02:13.4736426Z ==============================================================================
2019-12-03T13:02:13.4736489Z Task         : Get sources
2019-12-03T13:02:13.4736558Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

src/librustc_lint/unused.rs Outdated Show resolved Hide resolved
src/librustc_lint/unused.rs Outdated Show resolved Hide resolved
Co-Authored-By: lzutao <taolzu@gmail.com>
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-12-03T14:08:28.3634237Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-12-03T14:08:28.3827394Z ##[command]git config gc.auto 0
2019-12-03T14:08:28.3921937Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-12-03T14:08:28.3984648Z ##[command]git config --get-all http.proxy
2019-12-03T14:08:28.4142899Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/66983/merge:refs/remotes/pull/66983/merge
---
2019-12-03T15:09:56.4701121Z .................................................................................................... 1600/9319
2019-12-03T15:10:01.4819867Z .................................................................................................... 1700/9319
2019-12-03T15:10:14.9913119Z ........................................i........................................................... 1800/9319
2019-12-03T15:10:23.3653223Z .................................................................................................... 1900/9319
2019-12-03T15:10:37.8077363Z .........................iiiii...................................................................... 2000/9319
2019-12-03T15:10:48.7586363Z .................................................................................................... 2200/9319
2019-12-03T15:10:51.5297996Z .................................................................................................... 2300/9319
2019-12-03T15:10:56.4118704Z .................................................................................................... 2400/9319
2019-12-03T15:11:19.0566610Z .................................................................................................... 2500/9319
---
2019-12-03T15:14:07.5669857Z ..........................i...............i......................................................... 4800/9319
2019-12-03T15:14:18.6930583Z .................................................................................................... 4900/9319
2019-12-03T15:14:25.0616679Z .................................................................................................... 5000/9319
2019-12-03T15:14:33.5728468Z .................................................................................................... 5100/9319
2019-12-03T15:14:41.5585645Z ................................ii.ii...........i................................................... 5200/9319
2019-12-03T15:14:51.6262785Z .................................................................................................... 5400/9319
2019-12-03T15:15:02.3454870Z .................................................................................................... 5500/9319
2019-12-03T15:15:09.8867685Z ..............i..................................................................................... 5600/9319
2019-12-03T15:15:16.5988670Z .................................................................................................... 5700/9319
2019-12-03T15:15:16.5988670Z .................................................................................................... 5700/9319
2019-12-03T15:15:28.4745522Z .................................................................................................... 5800/9319
2019-12-03T15:15:41.0160635Z ii...i..ii...........i.............................................................................. 5900/9319
2019-12-03T15:16:00.3497220Z .................................................................................................... 6100/9319
2019-12-03T15:16:07.6007673Z .................................................................................................... 6200/9319
2019-12-03T15:16:07.6007673Z .................................................................................................... 6200/9319
2019-12-03T15:16:22.0810692Z .......................i..ii........................................................................ 6300/9319
2019-12-03T15:16:43.0439938Z ..............................................................................................i..... 6500/9319
2019-12-03T15:16:45.4807500Z .................................................................................................... 6600/9319
2019-12-03T15:16:47.9361790Z .....................................................................................i.............. 6700/9319
2019-12-03T15:16:50.7769721Z .................................................................................................... 6800/9319
---
2019-12-03T15:21:53.4584638Z 
2019-12-03T15:21:53.4585139Z - warning: unnecessary parentheses around function argument
2019-12-03T15:21:53.4585588Z -   --> $DIR/issue-47775-nested-macro-unnecessary-parens-arg.rs:22:83
2019-12-03T15:21:53.4586253Z -    |
2019-12-03T15:21:53.4586725Z - LL |         #[allow(dead_code)] fn the_night_for_the_morrow() -> Option<isize> { Some((2)) }
2019-12-03T15:21:53.4587737Z - ...
2019-12-03T15:21:53.4587737Z - ...
2019-12-03T15:21:53.4588111Z - LL | and_the_heavens_reject_not!();
2019-12-03T15:21:53.4588896Z -    |
2019-12-03T15:21:53.4589263Z - note: lint level defined here
2019-12-03T15:21:53.4589668Z -   --> $DIR/issue-47775-nested-macro-unnecessary-parens-arg.rs:3:9
2019-12-03T15:21:53.4590047Z -    |
2019-12-03T15:21:53.4590047Z -    |
2019-12-03T15:21:53.4590410Z - LL | #![warn(unused_parens)]
2019-12-03T15:21:53.4590794Z -    |         ^^^^^^^^^^^^^
2019-12-03T15:21:53.4591136Z - 
2019-12-03T15:21:53.4591465Z - 
2019-12-03T15:21:53.4591613Z 
2019-12-03T15:21:53.4591752Z 
2019-12-03T15:21:53.4592509Z error: failed to delete `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/lint/issue-47775-nested-macro-unnecessary-parens-arg/issue-47775-nested-macro-unnecessary-parens-arg.stderr`: No such file or directory (os error 2)
2019-12-03T15:21:53.4593203Z [ERROR compiletest::runtest] fatal error, panic: "failed to delete `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/lint/issue-47775-nested-macro-unnecessary-parens-arg/issue-47775-nested-macro-unnecessary-parens-arg.stderr`: No such file or directory (os error 2)"
2019-12-03T15:21:53.4594781Z thread '[ui] ui/lint/issue-47775-nested-macro-unnecessary-parens-arg.rs' panicked at 'fatal error', src/tools/compiletest/src/runtest.rs:2276:9
2019-12-03T15:21:53.4595268Z 
2019-12-03T15:21:53.4595388Z 
2019-12-03T15:21:53.4596748Z failures:
2019-12-03T15:21:53.4597259Z     [ui] ui/lint/issue-47775-nested-macro-unnecessary-parens-arg.rs
2019-12-03T15:21:53.4597259Z     [ui] ui/lint/issue-47775-nested-macro-unnecessary-parens-arg.rs
2019-12-03T15:21:53.4597431Z 
2019-12-03T15:21:53.4598022Z test result: FAILED. 9271 passed; 1 failed; 47 ignored; 0 measured; 0 filtered out
2019-12-03T15:21:53.4598202Z 
2019-12-03T15:21:53.4643171Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:537:22
2019-12-03T15:21:53.4661701Z 
2019-12-03T15:21:53.4661780Z 
2019-12-03T15:21:53.4668811Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
2019-12-03T15:21:53.4669402Z 
2019-12-03T15:21:53.4669439Z 
2019-12-03T15:21:53.4682307Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-12-03T15:21:53.4682404Z Build completed unsuccessfully in 1:07:12
2019-12-03T15:21:53.4682404Z Build completed unsuccessfully in 1:07:12
2019-12-03T15:21:53.4748390Z == clock drift check ==
2019-12-03T15:21:53.4762272Z   local time: Tue Dec  3 15:21:53 UTC 2019
2019-12-03T15:21:53.7564451Z   network time: Tue, 03 Dec 2019 15:21:53 GMT
2019-12-03T15:21:53.7564957Z == end clock drift check ==
2019-12-03T15:21:54.5791397Z 
2019-12-03T15:21:54.5893645Z ##[error]Bash exited with code '1'.
2019-12-03T15:21:54.5930250Z ##[section]Starting: Checkout
2019-12-03T15:21:54.5932132Z ==============================================================================
2019-12-03T15:21:54.5932192Z Task         : Get sources
2019-12-03T15:21:54.5932242Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@weiznich weiznich mentioned this pull request Dec 6, 2019
@Mark-Simulacrum Mark-Simulacrum added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Dec 6, 2019
@estebank
Copy link
Contributor

Based on the discussion in #66295, r=me once my nitpick is addressed or answered.

@estebank
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Dec 11, 2019

📌 Commit ab3f4fd has been approved by estebank

@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 Dec 11, 2019
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Dec 12, 2019
…bank

Fix `unused_parens` triggers on macro by example code

Fix rust-lang#66295

Unfortunately this does also break [an existing test](https://github.com/rust-lang/rust/blob/4787e97475de6be9487e3d9255a9c2d3c0bf9252/src/test/ui/lint/issue-47775-nested-macro-unnecessary-parens-arg.rs#L22). I'm not sure how to handle that, because that seems to be quite similar to the allowed cases

If this gets accepted it would be great to backport this fix to beta.
bors added a commit that referenced this pull request Dec 12, 2019
Rollup of 8 pull requests

Successful merges:

 - #62514 (Clarify `Box<T>` representation and its use in FFI)
 - #66983 (Fix `unused_parens` triggers on macro by example code)
 - #67215 (Fix `-Z print-type-sizes`'s handling of zero-sized fields.)
 - #67230 (Remove irelevant comment on `register_dtor`)
 - #67236 (resolve: Always resolve visibilities on impl items)
 - #67237 (Some small readability improvements)
 - #67238 (Small std::borrow::Cow improvements)
 - #67239 (Make TinyList::remove iterate instead of recurse)

Failed merges:

r? @ghost
@bors bors merged commit ab3f4fd into rust-lang:master Dec 12, 2019
@nikomatsakis nikomatsakis added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Dec 13, 2019
@nikomatsakis
Copy link
Contributor

Accepted for backport in today's design meeting

@Mark-Simulacrum Mark-Simulacrum removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Dec 14, 2019
bors added a commit that referenced this pull request Dec 14, 2019
[beta] Beta backports

Backporting the following pull requests:

 * resolve: Always resolve visibilities on impl items #67236
 * resolve: Resolve visibilities on fields with non-builtin attributes #67106
 * E0023: handle expected != tuple pattern type #67044
 * Fix `unused_parens` triggers on macro by example code #66983
 * Fix some issues with attributes on unnamed fields #66669
 * Ensure that we get a hard error on generic ZST constants if their bodies #67134 (via #67297)

Some of these conflicted on merge, I resolved where possible, sometimes by cherry-picking a commit or two more from the relevant PRs. Since those changes are necessary though for backport to proceed (otherwise not even std/core compile), seems fine -- they're fairly minor cleanups anyway.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. 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.

unused_parens triggers on macro by example code.
7 participants