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

Clean up `parse_bottom_expr` to use list parsing utility #64105

Open
wants to merge 2 commits into
base: master
from

Conversation

@achan1989
Copy link

commented Sep 2, 2019

Fixes #63396

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Sep 2, 2019

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @eddyb (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

This comment has been minimized.

Copy link
Collaborator

commented Sep 3, 2019

The job x86_64-gnu-llvm-6.0 of your PR failed (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-09-02T23:44:32.2596802Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-09-02T23:44:32.8904171Z ##[command]git config gc.auto 0
2019-09-02T23:44:32.8907525Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-09-02T23:44:32.8910421Z ##[command]git config --get-all http.proxy
2019-09-02T23:44:32.8915579Z ##[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/64105/merge:refs/remotes/pull/64105/merge
---
2019-09-03T00:50:08.3087562Z .................................................................................................... 1500/8987
2019-09-03T00:50:14.3291396Z .................................................................................................... 1600/8987
2019-09-03T00:50:27.8083591Z .................................................i...............i.................................. 1700/8987
2019-09-03T00:50:36.5669672Z .................................................................................................... 1800/8987
2019-09-03T00:50:51.3728442Z ................................F.......iiiii....................................................... 1900/8987
2019-09-03T00:51:03.0518505Z .................................................................................................... 2100/8987
2019-09-03T00:51:05.8492063Z .................................................................................................... 2200/8987
2019-09-03T00:51:10.2811415Z .................................................................................................... 2300/8987
2019-09-03T00:51:18.3994344Z .........F.......................................................................................... 2400/8987
---
2019-09-03T00:54:29.9737117Z ...........................i...............i........................................................ 4700/8987
2019-09-03T00:54:42.7132729Z .................................................................................................... 4800/8987
2019-09-03T00:54:49.3228946Z .................................................................................................... 4900/8987
2019-09-03T00:55:01.0520234Z .................................................................................................... 5000/8987
2019-09-03T00:55:07.1147815Z ........ii.ii....................................................................................... 5100/8987
2019-09-03T00:55:21.2511147Z .................................................................................................... 5300/8987
2019-09-03T00:55:30.1410410Z .......................................................................i............................ 5400/8987
2019-09-03T00:55:37.9411557Z .................................................................................................... 5500/8987
2019-09-03T00:55:45.0437262Z .................................................................................................... 5600/8987
2019-09-03T00:55:45.0437262Z .................................................................................................... 5600/8987
2019-09-03T00:55:56.4666678Z .................................................................ii...i..ii...........i............. 5700/8987
2019-09-03T00:56:24.2393843Z .................................................................................................... 5900/8987
2019-09-03T00:56:35.1822909Z .................................................................................................... 6000/8987
2019-09-03T00:56:35.1822909Z .................................................................................................... 6000/8987
2019-09-03T00:56:42.4863032Z ...................................................................i..ii............................ 6100/8987
2019-09-03T00:57:13.8592807Z .................................................................................................... 6300/8987
2019-09-03T00:57:16.1670978Z ......................i............................................................................. 6400/8987
2019-09-03T00:57:18.5726968Z ..............................................................................................i..... 6500/8987
2019-09-03T00:57:21.5165018Z .................................................................................................... 6600/8987
---
2019-09-03T01:01:45.0498366Z 
2019-09-03T01:01:45.0499259Z ---- [ui] ui/did_you_mean/issue-54109-and_instead_of_ampersands.rs stdout ----
2019-09-03T01:01:45.0499785Z diff of stderr:
2019-09-03T01:01:45.0500061Z 
2019-09-03T01:01:45.0500542Z 27    |           expected one of 8 possible tokens here
2019-09-03T01:01:45.0500823Z 28    |           help: use `&&` instead of `and` for the boolean operator
2019-09-03T01:01:45.0501155Z 29 
2019-09-03T01:01:45.0501571Z + error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found `b`
2019-09-03T01:01:45.0502239Z +   --> $DIR/issue-54109-and_instead_of_ampersands.rs:22:15
2019-09-03T01:01:45.0502737Z +    |
2019-09-03T01:01:45.0502995Z + LL |     if (a and b) {
2019-09-03T01:01:45.0503368Z +    |               ^ expected one of 8 possible tokens here
2019-09-03T01:01:45.0503811Z + 
2019-09-03T01:01:45.0504567Z 30 error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found `or`
2019-09-03T01:01:45.0506582Z 32    |
2019-09-03T01:01:45.0506790Z 
2019-09-03T01:01:45.0507047Z 36    |           expected one of 8 possible tokens here
2019-09-03T01:01:45.0507047Z 36    |           expected one of 8 possible tokens here
2019-09-03T01:01:45.0507285Z 37    |           help: use `||` instead of `or` for the boolean operator
2019-09-03T01:01:45.0507662Z 38 
2019-09-03T01:01:45.0508076Z + error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found `b`
2019-09-03T01:01:45.0508633Z +   --> $DIR/issue-54109-and_instead_of_ampersands.rs:31:14
2019-09-03T01:01:45.0508908Z +    |
2019-09-03T01:01:45.0509154Z + LL |     if (a or b) {
2019-09-03T01:01:45.0509372Z +    |              ^ expected one of 8 possible tokens here
2019-09-03T01:01:45.0509591Z + 
2019-09-03T01:01:45.0509836Z 39 error: expected one of `!`, `.`, `::`, `?`, `{`, or an operator, found `and`
2019-09-03T01:01:45.0510584Z 41    |
2019-09-03T01:01:45.0510800Z 
2019-09-03T01:01:45.0510800Z 
2019-09-03T01:01:45.0511548Z 54    |             expected one of `!`, `.`, `::`, `?`, `{`, or an operator here
2019-09-03T01:01:45.0511777Z 55    |             help: use `||` instead of `or` for the boolean operator
2019-09-03T01:01:45.0512411Z - error: aborting due to 6 previous errors
2019-09-03T01:01:45.0512411Z - error: aborting due to 6 previous errors
2019-09-03T01:01:45.0512599Z + error[E0425]: cannot find value `and` in this scope
2019-09-03T01:01:45.0512997Z +   --> $DIR/issue-54109-and_instead_of_ampersands.rs:22:11
2019-09-03T01:01:45.0513172Z +    |
2019-09-03T01:01:45.0513313Z + LL |     if (a and b) {
2019-09-03T01:01:45.0513915Z 58 
2019-09-03T01:01:45.0513915Z 58 
2019-09-03T01:01:45.0514851Z + error[E0425]: cannot find value `or` in this scope
2019-09-03T01:01:45.0515282Z +   --> $DIR/issue-54109-and_instead_of_ampersands.rs:31:11
2019-09-03T01:01:45.0515468Z +    |
2019-09-03T01:01:45.0515638Z + LL |     if (a or b) {
2019-09-03T01:01:45.0515982Z + 
2019-09-03T01:01:45.0516152Z + error: aborting due to 10 previous errors
2019-09-03T01:01:45.0516305Z + 
2019-09-03T01:01:45.0516698Z + For more information about this error, try `rustc --explain E0425`.
2019-09-03T01:01:45.0516698Z + For more information about this error, try `rustc --explain E0425`.
2019-09-03T01:01:45.0516903Z 59 
2019-09-03T01:01:45.0517039Z 
2019-09-03T01:01:45.0517171Z 
2019-09-03T01:01:45.0517324Z The actual stderr differed from the expected stderr.
2019-09-03T01:01:45.0517852Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands/issue-54109-and_instead_of_ampersands.stderr
2019-09-03T01:01:45.0518320Z To update references, rerun the tests and pass the `--bless` flag
2019-09-03T01:01:45.0518811Z To only update this specific test, also pass `--test-args did_you_mean/issue-54109-and_instead_of_ampersands.rs`
2019-09-03T01:01:45.0519138Z error: 1 errors occurred comparing output.
2019-09-03T01:01:45.0519321Z status: exit code: 1
2019-09-03T01:01:45.0519321Z status: exit code: 1
2019-09-03T01:01:45.0520301Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands/auxiliary" "-A" "unused"
2019-09-03T01:01:45.0521095Z ------------------------------------------
2019-09-03T01:01:45.0521272Z 
2019-09-03T01:01:45.0521793Z ------------------------------------------
2019-09-03T01:01:45.0521962Z stderr:
2019-09-03T01:01:45.0521962Z stderr:
2019-09-03T01:01:45.0522323Z ------------------------------------------
2019-09-03T01:01:45.0522689Z error: expected `{`, found `and`
2019-09-03T01:01:45.0523329Z    |
2019-09-03T01:01:45.0523691Z LL |     if a and b {
2019-09-03T01:01:45.0524415Z    |     --   ^^^
2019-09-03T01:01:45.0524653Z    |     |    |
2019-09-03T01:01:45.0524653Z    |     |    |
2019-09-03T01:01:45.0524812Z    |     |    expected `{`
2019-09-03T01:01:45.0525107Z    |     |    help: use `&&` instead of `and` for the boolean operator
2019-09-03T01:01:45.0525320Z    |     this `if` statement has a condition, but no block
2019-09-03T01:01:45.0525457Z 
2019-09-03T01:01:45.0525625Z error: expected `{`, found `or`
2019-09-03T01:01:45.0526282Z    |
2019-09-03T01:01:45.0526282Z    |
2019-09-03T01:01:45.0526455Z LL |     if a or b {
2019-09-03T01:01:45.0526786Z    |     --   ^^
2019-09-03T01:01:45.0527131Z    |     |    expected `{`
2019-09-03T01:01:45.0527131Z    |     |    expected `{`
2019-09-03T01:01:45.0527307Z    |     |    help: use `||` instead of `or` for the boolean operator
2019-09-03T01:01:45.0527467Z    |     this `if` statement has a condition, but no block
2019-09-03T01:01:45.0527962Z 
2019-09-03T01:01:45.0528137Z error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found `and`
2019-09-03T01:01:45.0528745Z    |
2019-09-03T01:01:45.0528745Z    |
2019-09-03T01:01:45.0528893Z LL |     if (a and b) {
2019-09-03T01:01:45.0529201Z    |           |
2019-09-03T01:01:45.0529453Z    |           expected one of 8 possible tokens here
2019-09-03T01:01:45.0529453Z    |           expected one of 8 possible tokens here
2019-09-03T01:01:45.0529618Z    |           help: use `&&` instead of `and` for the boolean operator
2019-09-03T01:01:45.0529768Z 
2019-09-03T01:01:45.0529925Z error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found `b`
2019-09-03T01:01:45.0530554Z    |
2019-09-03T01:01:45.0530554Z    |
2019-09-03T01:01:45.0530705Z LL |     if (a and b) {
2019-09-03T01:01:45.0530872Z    |               ^ expected one of 8 possible tokens here
2019-09-03T01:01:45.0531001Z 
2019-09-03T01:01:45.0531155Z error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found `or`
2019-09-03T01:01:45.0531759Z    |
2019-09-03T01:01:45.0531759Z    |
2019-09-03T01:01:45.0531905Z LL |     if (a or b) {
2019-09-03T01:01:45.0532213Z    |           |
2019-09-03T01:01:45.0532364Z    |           expected one of 8 possible tokens here
2019-09-03T01:01:45.0532364Z    |           expected one of 8 possible tokens here
2019-09-03T01:01:45.0532530Z    |           help: use `||` instead of `or` for the boolean operator
2019-09-03T01:01:45.0532661Z 
2019-09-03T01:01:45.0532817Z error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found `b`
2019-09-03T01:01:45.0533417Z    |
2019-09-03T01:01:45.0533417Z    |
2019-09-03T01:01:45.0533564Z LL |     if (a or b) {
2019-09-03T01:01:45.0533731Z    |              ^ expected one of 8 possible tokens here
2019-09-03T01:01:45.0533859Z 
2019-09-03T01:01:45.0534371Z error: expected one of `!`, `.`, `::`, `?`, `{`, or an operator, found `and`
2019-09-03T01:01:45.0536643Z    |
2019-09-03T01:01:45.0536889Z LL |     while a and b {
2019-09-03T01:01:45.0537049Z    |             ^^^
2019-09-03T01:01:45.0537226Z    |             |
2019-09-03T01:01:45.0537226Z    |             |
2019-09-03T01:01:45.0537387Z    |             expected one of `!`, `.`, `::`, `?`, `{`, or an operator here
2019-09-03T01:01:45.0537553Z    |             help: use `&&` instead of `and` for the boolean operator
2019-09-03T01:01:45.0537689Z 
2019-09-03T01:01:45.0537870Z error: expected one of `!`, `.`, `::`, `?`, `{`, or an operator, found `or`
2019-09-03T01:01:45.0538817Z    |
2019-09-03T01:01:45.0538817Z    |
2019-09-03T01:01:45.0538974Z LL |     while a or b {
2019-09-03T01:01:45.0539320Z    |             |
2019-09-03T01:01:45.0539320Z    |             |
2019-09-03T01:01:45.0539484Z    |             expected one of `!`, `.`, `::`, `?`, `{`, or an operator here
2019-09-03T01:01:45.0539764Z    |             help: use `||` instead of `or` for the boolean operator
2019-09-03T01:01:45.0540134Z error[E0425]: cannot find value `and` in this scope
2019-09-03T01:01:45.0546582Z   --> /checkout/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.rs:22:11
2019-09-03T01:01:45.0546921Z    |
2019-09-03T01:01:45.0546921Z    |
2019-09-03T01:01:45.0547089Z LL |     if (a and b) {
2019-09-03T01:01:45.0547757Z 
2019-09-03T01:01:45.0547944Z error[E0425]: cannot find value `or` in this scope
2019-09-03T01:01:45.0548443Z   --> /checkout/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.rs:31:11
2019-09-03T01:01:45.0548634Z    |
2019-09-03T01:01:45.0548634Z    |
2019-09-03T01:01:45.0548787Z LL |     if (a or b) {
2019-09-03T01:01:45.0549080Z 
2019-09-03T01:01:45.0549231Z error: aborting due to 10 previous errors
2019-09-03T01:01:45.0549359Z 
2019-09-03T01:01:45.0549748Z For more information about this error, try `rustc --explain E0425`.
2019-09-03T01:01:45.0549748Z For more information about this error, try `rustc --explain E0425`.
2019-09-03T01:01:45.0549943Z 
2019-09-03T01:01:45.0550318Z ------------------------------------------
2019-09-03T01:01:45.0550499Z 
2019-09-03T01:01:45.0550633Z 
2019-09-03T01:01:45.0550987Z ---- [ui] ui/expr_attr_paren_order.rs stdout ----
2019-09-03T01:01:45.0551169Z diff of stderr:
2019-09-03T01:01:45.0551320Z 
2019-09-03T01:01:45.0551690Z - error: variable `X` should have a snake case name
2019-09-03T01:01:45.0552276Z + error: an inner attribute is not permitted in this context
2019-09-03T01:01:45.0552709Z +   --> $DIR/expr_attr_paren_order.rs:9:9
2019-09-03T01:01:45.0552924Z 3    |
2019-09-03T01:01:45.0553280Z - LL |             let X = 0;
2019-09-03T01:01:45.0553280Z - LL |             let X = 0;
2019-09-03T01:01:45.0553685Z -    |                 ^ help: convert the identifier to snake case: `x`
2019-09-03T01:01:45.0554047Z + LL |         #![allow(non_snake_case)]
2019-09-03T01:01:45.0554940Z 6    |
2019-09-03T01:01:45.0555329Z - note: lint level defined here
2019-09-03T01:01:45.0555768Z -   --> $DIR/expr_attr_paren_order.rs:17:17
2019-09-03T01:01:45.0555768Z -   --> $DIR/expr_attr_paren_order.rs:17:17
2019-09-03T01:01:45.0556302Z +    = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them.
2019-09-03T01:01:45.0556677Z + error: an inner attribute is not permitted in this context
2019-09-03T01:01:45.0557092Z +   --> $DIR/expr_attr_paren_order.rs:17:9
2019-09-03T01:01:45.0557285Z 9    |
2019-09-03T01:01:45.0557285Z 9    |
2019-09-03T01:01:45.0557466Z 10 LL |         #![deny(non_snake_case)]
2019-09-03T01:01:45.0564421Z +    |         ^^^^^^^^^^^^^^^^^^^^^^^^
2019-09-03T01:01:45.0564504Z +    |
2019-09-03T01:01:45.0564504Z +    |
2019-09-03T01:01:45.0564585Z +    = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them.
2019-09-03T01:01:45.0565083Z - error: aborting due to previous error
2019-09-03T01:01:45.0565137Z + error: aborting due to 2 previous errors
2019-09-03T01:01:45.0565180Z 14 
2019-09-03T01:01:45.0565236Z 15 
2019-09-03T01:01:45.0565236Z 15 
2019-09-03T01:01:45.0565266Z 
2019-09-03T01:01:45.0565292Z 
2019-09-03T01:01:45.0565338Z The actual stderr differed from the expected stderr.
2019-09-03T01:01:45.0565679Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/expr_attr_paren_order/expr_attr_paren_order.stderr
2019-09-03T01:01:45.0566169Z To update references, rerun the tests and pass the `--bless` flag
2019-09-03T01:01:45.0566467Z To only update this specific test, also pass `--test-args expr_attr_paren_order.rs`
2019-09-03T01:01:45.0566574Z error: 1 errors occurred comparing output.
2019-09-03T01:01:45.0566623Z status: exit code: 1
2019-09-03T01:01:45.0566623Z status: exit code: 1
2019-09-03T01:01:45.0573884Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/expr_attr_paren_order.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/expr_attr_paren_order" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/expr_attr_paren_order/auxiliary" "-A" "unused"
2019-09-03T01:01:45.0575541Z ------------------------------------------
2019-09-03T01:01:45.0575608Z 
2019-09-03T01:01:45.0575853Z ------------------------------------------
2019-09-03T01:01:45.0575902Z stderr:
2019-09-03T01:01:45.0575902Z stderr:
2019-09-03T01:01:45.0576132Z ------------------------------------------
2019-09-03T01:01:45.0576185Z error: an inner attribute is not permitted in this context
2019-09-03T01:01:45.0576436Z   --> /checkout/src/test/ui/expr_attr_paren_order.rs:9:9
2019-09-03T01:01:45.0576505Z    |
2019-09-03T01:01:45.0576550Z LL |         #![allow(non_snake_case)]
2019-09-03T01:01:45.0576640Z    |
2019-09-03T01:01:45.0576640Z    |
2019-09-03T01:01:45.0576724Z    = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them.
2019-09-03T01:01:45.0576819Z error: an inner attribute is not permitted in this context
2019-09-03T01:01:45.0577089Z   --> /checkout/src/test/ui/expr_attr_paren_order.rs:17:9
2019-09-03T01:01:45.0577136Z    |
2019-09-03T01:01:45.0577136Z    |
2019-09-03T01:01:45.0577180Z LL |         #![deny(non_snake_case)]
2019-09-03T01:01:45.0577285Z    |
2019-09-03T01:01:45.0577285Z    |
2019-09-03T01:01:45.0577357Z    = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them.
2019-09-03T01:01:45.0577468Z error: aborting due to 2 previous errors
2019-09-03T01:01:45.0577497Z 
2019-09-03T01:01:45.0577523Z 
2019-09-03T01:01:45.0577758Z ------------------------------------------
---
2019-09-03T01:01:45.0579132Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:536:22
2019-09-03T01:01:45.0579191Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-09-03T01:01:45.0579246Z 
2019-09-03T01:01:45.0579272Z 
2019-09-03T01:01:45.0580862Z 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-09-03T01:01:45.0581199Z 
2019-09-03T01:01:45.0581227Z 
2019-09-03T01:01:45.0588139Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-09-03T01:01:45.0588266Z Build completed unsuccessfully in 1:09:47
2019-09-03T01:01:45.0588266Z Build completed unsuccessfully in 1:09:47
2019-09-03T01:01:45.0632187Z == clock drift check ==
2019-09-03T01:01:45.0648740Z   local time: Tue Sep  3 01:01:45 UTC 2019
2019-09-03T01:01:45.2157573Z   network time: Tue, 03 Sep 2019 01:01:45 GMT
2019-09-03T01:01:45.2217008Z == end clock drift check ==
2019-09-03T01:01:46.0086208Z ##[error]Bash exited with code '1'.
2019-09-03T01:01:46.0125779Z ##[section]Starting: Checkout
2019-09-03T01:01:46.0127638Z ==============================================================================
2019-09-03T01:01:46.0127695Z Task         : Get sources
2019-09-03T01:01:46.0127742Z 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)

@@ -787,51 +789,16 @@ impl<'a> Parser<'a> {
parse_lit!()
}
token::OpenDelim(token::Paren) => {
self.bump();

This comment has been minimized.

Copy link
@Centril

Centril Sep 3, 2019

Member

The order matters here. You've changed the parser to accept ( inner_attr* expr_0, ..., expr_n ) to accepting inner_attr* ( expr_0, ..., expr_n ).

To preserve the semantics you'll need to use parse_paren_comma_seq instead and then conditionally do parse_inner_attributes() on the first element. To avoid duplication, you'll also need to refactor the match p.parse_expr() { ... } bit in parse_paren_expr_seq into a different function.

To catch similar mistakes in the future, let's also add a test:

#![feature(stmt_expr_attributes)]

fn main() {
    let x = #![allow(warnings)] (1, 2);
    //~^ ERROR an inner attribute is not permitted in this context
}

This comment has been minimized.

Copy link
@achan1989

achan1989 Sep 6, 2019

Author

Ok, I have a test and a proper fix now.

My original refactoring of parse_paren_expr_seq is now unnecessary, and currently just contributes extra noise. I'd like to undo it. But if I back it out locally and force push I believe the current review comments will be lost -- is that ok? Or should I do something else?

This comment has been minimized.

Copy link
@estebank

estebank Sep 6, 2019

Contributor

The comments themselves and the code snippet remain, it should be fine.

@Centril

This comment has been minimized.

Copy link
Member

commented Sep 3, 2019

As for the errors about if A or B we should probably handle that more gracefully in the binary expression parser instead as-if the user had written if A || B.

r? @estebank

@rust-highfive rust-highfive assigned estebank and unassigned eddyb Sep 3, 2019

@bors

This comment has been minimized.

Copy link
Contributor

commented Sep 7, 2019

☔️ The latest upstream changes (presumably #64264) made this pull request unmergeable. Please resolve the merge conflicts.

@JohnCSimon

This comment has been minimized.

Copy link

commented Sep 14, 2019

Ping from triage
@achan1989 This PR now has a conflict, can you please resolve this?
Thanks.

@achan1989 achan1989 force-pushed the achan1989:cleanup-parsing branch from 321b690 to abc30b2 Sep 16, 2019

@achan1989

This comment has been minimized.

Copy link
Author

commented Sep 16, 2019

I've re-pushed the code that I have so far. The errors about if A or B are not resolved, and I can't understand what's going on. Unless there's an obvious error I think I'll have to hand over to someone else, or abandon this entirely. Sorry :(

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Sep 16, 2019

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-09-16T21:20:41.9134614Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-09-16T21:20:41.9362142Z ##[command]git config gc.auto 0
2019-09-16T21:20:41.9417970Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-09-16T21:20:41.9471939Z ##[command]git config --get-all http.proxy
2019-09-16T21:20:41.9602403Z ##[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/64105/merge:refs/remotes/pull/64105/merge
---
2019-09-16T22:22:48.3839425Z .................................................................................................... 1500/9023
2019-09-16T22:22:54.2815449Z .................................................................................................... 1600/9023
2019-09-16T22:23:06.9333926Z ...............................................................i...............i.................... 1700/9023
2019-09-16T22:23:14.1502694Z .................................................................................................... 1800/9023
2019-09-16T22:23:29.5700455Z ..............................................F.......iiiii......................................... 1900/9023
2019-09-16T22:23:41.0781528Z .................................................................................................... 2100/9023
2019-09-16T22:23:43.5850331Z .................................................................................................... 2200/9023
2019-09-16T22:23:46.9932432Z .................................................................................................... 2300/9023
2019-09-16T22:23:55.3279799Z .................................................................................................... 2400/9023
---
2019-09-16T22:26:53.4166270Z ..........................................i...............i......................................... 4700/9023
2019-09-16T22:27:04.0641806Z .................................................................................................... 4800/9023
2019-09-16T22:27:11.1659409Z .................................................................................................... 4900/9023
2019-09-16T22:27:20.7418618Z .................................................................................................... 5000/9023
2019-09-16T22:27:28.5292032Z ..........................ii.ii..................................................................... 5100/9023
2019-09-16T22:27:38.7600914Z .................................................................................................... 5300/9023
2019-09-16T22:27:48.9268213Z ..........................................................................................i......... 5400/9023
2019-09-16T22:27:57.1887175Z .................................................................................................... 5500/9023
2019-09-16T22:28:02.1988377Z .................................................................................................... 5600/9023
2019-09-16T22:28:02.1988377Z .................................................................................................... 5600/9023
2019-09-16T22:28:12.7743433Z .....................................................................................ii...i..ii..... 5700/9023
2019-09-16T22:28:38.2329056Z .................................................................................................... 5900/9023
2019-09-16T22:28:47.0033413Z .................................................................................................... 6000/9023
2019-09-16T22:28:47.0033413Z .................................................................................................... 6000/9023
2019-09-16T22:28:51.5563316Z .......................................................................................i..ii........ 6100/9023
2019-09-16T22:29:20.4882110Z .................................................................................................... 6300/9023
2019-09-16T22:29:24.1291203Z ..............................................i..................................................... 6400/9023
2019-09-16T22:29:26.1496873Z .................................................................................................... 6500/9023
2019-09-16T22:29:28.5772494Z ..................i................................................................................. 6600/9023
---
2019-09-16T22:33:35.1693502Z 
2019-09-16T22:33:35.1694479Z ---- [ui] ui/did_you_mean/issue-54109-and_instead_of_ampersands.rs stdout ----
2019-09-16T22:33:35.1695308Z diff of stderr:
2019-09-16T22:33:35.1695463Z 
2019-09-16T22:33:35.1695553Z 27    |           expected one of 8 possible tokens here
2019-09-16T22:33:35.1695610Z 28    |           help: use `&&` instead of `and` for the boolean operator
2019-09-16T22:33:35.1695657Z 29 
2019-09-16T22:33:35.1695738Z + error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found `b`
2019-09-16T22:33:35.1696332Z +   --> $DIR/issue-54109-and_instead_of_ampersands.rs:22:15
2019-09-16T22:33:35.1696404Z +    |
2019-09-16T22:33:35.1696449Z + LL |     if (a and b) {
2019-09-16T22:33:35.1696528Z +    |               ^ expected one of 8 possible tokens here
2019-09-16T22:33:35.1696573Z + 
2019-09-16T22:33:35.1696625Z 30 error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found `or`
2019-09-16T22:33:35.1696957Z 32    |
2019-09-16T22:33:35.1696986Z 
2019-09-16T22:33:35.1697033Z 36    |           expected one of 8 possible tokens here
2019-09-16T22:33:35.1697033Z 36    |           expected one of 8 possible tokens here
2019-09-16T22:33:35.1697109Z 37    |           help: use `||` instead of `or` for the boolean operator
2019-09-16T22:33:35.1697154Z 38 
2019-09-16T22:33:35.1697203Z + error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found `b`
2019-09-16T22:33:35.1697473Z +   --> $DIR/issue-54109-and_instead_of_ampersands.rs:31:14
2019-09-16T22:33:35.1697532Z +    |
2019-09-16T22:33:35.1697576Z + LL |     if (a or b) {
2019-09-16T22:33:35.1697658Z +    |              ^ expected one of 8 possible tokens here
2019-09-16T22:33:35.1697703Z + 
2019-09-16T22:33:35.1697752Z 39 error: expected one of `!`, `.`, `::`, `?`, `{`, or an operator, found `and`
2019-09-16T22:33:35.1698072Z 41    |
2019-09-16T22:33:35.1698099Z 
2019-09-16T22:33:35.1698099Z 
2019-09-16T22:33:35.1698148Z 54    |             expected one of `!`, `.`, `::`, `?`, `{`, or an operator here
2019-09-16T22:33:35.1698222Z 55    |             help: use `||` instead of `or` for the boolean operator
2019-09-16T22:33:35.1698631Z - error: aborting due to 6 previous errors
2019-09-16T22:33:35.1698631Z - error: aborting due to 6 previous errors
2019-09-16T22:33:35.1698694Z + error[E0425]: cannot find value `and` in this scope
2019-09-16T22:33:35.1698887Z +   --> $DIR/issue-54109-and_instead_of_ampersands.rs:22:11
2019-09-16T22:33:35.1698923Z +    |
2019-09-16T22:33:35.1699190Z + LL |     if (a and b) {
2019-09-16T22:33:35.1699289Z 58 
2019-09-16T22:33:35.1699289Z 58 
2019-09-16T22:33:35.1699325Z + error[E0425]: cannot find value `or` in this scope
2019-09-16T22:33:35.1699587Z +   --> $DIR/issue-54109-and_instead_of_ampersands.rs:31:11
2019-09-16T22:33:35.1699624Z +    |
2019-09-16T22:33:35.1699659Z + LL |     if (a or b) {
2019-09-16T22:33:35.1699751Z + 
2019-09-16T22:33:35.1699786Z + error: aborting due to 10 previous errors
2019-09-16T22:33:35.1699838Z + 
2019-09-16T22:33:35.1700039Z + For more information about this error, try `rustc --explain E0425`.
2019-09-16T22:33:35.1700039Z + For more information about this error, try `rustc --explain E0425`.
2019-09-16T22:33:35.1700078Z 59 
2019-09-16T22:33:35.1700099Z 
2019-09-16T22:33:35.1700139Z 
2019-09-16T22:33:35.1700176Z The actual stderr differed from the expected stderr.
2019-09-16T22:33:35.1700470Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands/issue-54109-and_instead_of_ampersands.stderr
2019-09-16T22:33:35.1700866Z To update references, rerun the tests and pass the `--bless` flag
2019-09-16T22:33:35.1701115Z To only update this specific test, also pass `--test-args did_you_mean/issue-54109-and_instead_of_ampersands.rs`
2019-09-16T22:33:35.1701201Z error: 1 errors occurred comparing output.
2019-09-16T22:33:35.1701238Z status: exit code: 1
2019-09-16T22:33:35.1701238Z status: exit code: 1
2019-09-16T22:33:35.1701993Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands/auxiliary" "-A" "unused"
2019-09-16T22:33:35.1702281Z ------------------------------------------
2019-09-16T22:33:35.1702308Z 
2019-09-16T22:33:35.1702483Z ------------------------------------------
2019-09-16T22:33:35.1702519Z stderr:
2019-09-16T22:33:35.1702519Z stderr:
2019-09-16T22:33:35.1702712Z ------------------------------------------
2019-09-16T22:33:35.1702751Z error: expected `{`, found `and`
2019-09-16T22:33:35.1703023Z    |
2019-09-16T22:33:35.1703060Z LL |     if a and b {
2019-09-16T22:33:35.1703216Z    |     --   ^^^
2019-09-16T22:33:35.1703273Z    |     |    |
2019-09-16T22:33:35.1703273Z    |     |    |
2019-09-16T22:33:35.1703308Z    |     |    expected `{`
2019-09-16T22:33:35.1703351Z    |     |    help: use `&&` instead of `and` for the boolean operator
2019-09-16T22:33:35.1703414Z    |     this `if` statement has a condition, but no block
2019-09-16T22:33:35.1703617Z 
2019-09-16T22:33:35.1703652Z error: expected `{`, found `or`
2019-09-16T22:33:35.1703939Z    |
2019-09-16T22:33:35.1703939Z    |
2019-09-16T22:33:35.1703974Z LL |     if a or b {
2019-09-16T22:33:35.1704133Z    |     --   ^^
2019-09-16T22:33:35.1704227Z    |     |    expected `{`
2019-09-16T22:33:35.1704227Z    |     |    expected `{`
2019-09-16T22:33:35.1704267Z    |     |    help: use `||` instead of `or` for the boolean operator
2019-09-16T22:33:35.1704308Z    |     this `if` statement has a condition, but no block
2019-09-16T22:33:35.1704354Z 
2019-09-16T22:33:35.1704392Z error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found `and`
2019-09-16T22:33:35.1704675Z    |
2019-09-16T22:33:35.1704675Z    |
2019-09-16T22:33:35.1704710Z LL |     if (a and b) {
2019-09-16T22:33:35.1705424Z    |           |
2019-09-16T22:33:35.1705507Z    |           expected one of 8 possible tokens here
2019-09-16T22:33:35.1705507Z    |           expected one of 8 possible tokens here
2019-09-16T22:33:35.1705560Z    |           help: use `&&` instead of `and` for the boolean operator
2019-09-16T22:33:35.1705592Z 
2019-09-16T22:33:35.1705662Z error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found `b`
2019-09-16T22:33:35.1707285Z    |
2019-09-16T22:33:35.1707285Z    |
2019-09-16T22:33:35.1707353Z LL |     if (a and b) {
2019-09-16T22:33:35.1707402Z    |               ^ expected one of 8 possible tokens here
2019-09-16T22:33:35.1707433Z 
2019-09-16T22:33:35.1707480Z error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found `or`
2019-09-16T22:33:35.1709079Z    |
2019-09-16T22:33:35.1709079Z    |
2019-09-16T22:33:35.1709117Z LL |     if (a or b) {
2019-09-16T22:33:35.1709221Z    |           |
2019-09-16T22:33:35.1710376Z    |           expected one of 8 possible tokens here
2019-09-16T22:33:35.1710376Z    |           expected one of 8 possible tokens here
2019-09-16T22:33:35.1711028Z    |           help: use `||` instead of `or` for the boolean operator
2019-09-16T22:33:35.1711063Z 
2019-09-16T22:33:35.1711101Z error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found `b`
2019-09-16T22:33:35.1712096Z    |
2019-09-16T22:33:35.1712096Z    |
2019-09-16T22:33:35.1712719Z LL |     if (a or b) {
2019-09-16T22:33:35.1712832Z    |              ^ expected one of 8 possible tokens here
2019-09-16T22:33:35.1712879Z 
2019-09-16T22:33:35.1712917Z error: expected one of `!`, `.`, `::`, `?`, `{`, or an operator, found `and`
2019-09-16T22:33:35.1713225Z    |
2019-09-16T22:33:35.1713270Z LL |     while a and b {
2019-09-16T22:33:35.1713303Z    |             ^^^
2019-09-16T22:33:35.1713343Z    |             |
2019-09-16T22:33:35.1713343Z    |             |
2019-09-16T22:33:35.1713400Z    |             expected one of `!`, `.`, `::`, `?`, `{`, or an operator here
2019-09-16T22:33:35.1713443Z    |             help: use `&&` instead of `and` for the boolean operator
2019-09-16T22:33:35.1713467Z 
2019-09-16T22:33:35.1713524Z error: expected one of `!`, `.`, `::`, `?`, `{`, or an operator, found `or`
2019-09-16T22:33:35.1713956Z    |
2019-09-16T22:33:35.1713956Z    |
2019-09-16T22:33:35.1713989Z LL |     while a or b {
2019-09-16T22:33:35.1714079Z    |             |
2019-09-16T22:33:35.1714079Z    |             |
2019-09-16T22:33:35.1714118Z    |             expected one of `!`, `.`, `::`, `?`, `{`, or an operator here
2019-09-16T22:33:35.1714180Z    |             help: use `||` instead of `or` for the boolean operator
2019-09-16T22:33:35.1714248Z error[E0425]: cannot find value `and` in this scope
2019-09-16T22:33:35.1714493Z   --> /checkout/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.rs:22:11
2019-09-16T22:33:35.1714711Z    |
2019-09-16T22:33:35.1714711Z    |
2019-09-16T22:33:35.1714744Z LL |     if (a and b) {
2019-09-16T22:33:35.1715152Z 
2019-09-16T22:33:35.1716041Z error[E0425]: cannot find value `or` in this scope
2019-09-16T22:33:35.1716428Z   --> /checkout/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.rs:31:11
2019-09-16T22:33:35.1716503Z    |
2019-09-16T22:33:35.1716503Z    |
2019-09-16T22:33:35.1716545Z LL |     if (a or b) {
2019-09-16T22:33:35.1716624Z 
2019-09-16T22:33:35.1716687Z error: aborting due to 10 previous errors
2019-09-16T22:33:35.1716716Z 
2019-09-16T22:33:35.1716964Z For more information about this error, try `rustc --explain E0425`.
---
2019-09-16T22:33:35.1749009Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:536:22
2019-09-16T22:33:35.1749090Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-09-16T22:33:35.1767661Z 
2019-09-16T22:33:35.1767782Z 
2019-09-16T22:33:35.1769946Z 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-09-16T22:33:35.1770560Z 
2019-09-16T22:33:35.1770587Z 
2019-09-16T22:33:35.1779962Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-09-16T22:33:35.1780034Z Build completed unsuccessfully in 1:05:55
2019-09-16T22:33:35.1780034Z Build completed unsuccessfully in 1:05:55
2019-09-16T22:33:35.1833241Z == clock drift check ==
2019-09-16T22:33:35.1846269Z   local time: Mon Sep 16 22:33:35 UTC 2019
2019-09-16T22:33:35.3355052Z   network time: Mon, 16 Sep 2019 22:33:35 GMT
2019-09-16T22:33:35.3360478Z == end clock drift check ==
2019-09-16T22:33:36.2151188Z ##[error]Bash exited with code '1'.
2019-09-16T22:33:36.2202170Z ##[section]Starting: Checkout
2019-09-16T22:33:36.2203786Z ==============================================================================
2019-09-16T22:33:36.2203846Z Task         : Get sources
2019-09-16T22:33:36.2203884Z 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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.