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

if- and while-let-chains, take 2 - edition changes #53854

Merged
merged 3 commits into from Sep 10, 2018

Conversation

Projects
None yet
8 participants
@davidtwco
Copy link
Member

davidtwco commented Aug 31, 2018

Part of #53668.

r? @nikomatsakis

Added warning/error for if-let-chain ambiguity.
With eRFC 2497, previously accepted ambigious syntax regarding use of
`&&` and `||` in if-let and while-let statements should now warn
or error depending on the edition.

This commit takes a naive approach to detecting ambigious use of `&&`
or `||` and will probably need fine tuned to handle all cases.
Show resolved Hide resolved src/libsyntax/parse/parser.rs Outdated
@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Aug 31, 2018

cc @Centril -- so do you feel there is no need for a crater run here, given @SergioBenitez's testing?

@davidtwco davidtwco force-pushed the davidtwco:issue-53668 branch from bc285f6 to 600d6ca Aug 31, 2018

@Centril

This comment has been minimized.

Copy link
Contributor

Centril commented Aug 31, 2018

@nikomatsakis afair @SergioBenitez's testing was some time ago, so if we have the time for crater (we do right?) it could still be better safe than sorry to do a crater run; but I would also add that I don't feel strongly either way.

@davidtwco davidtwco force-pushed the davidtwco:issue-53668 branch from 600d6ca to eb278a3 Sep 2, 2018

@rust-highfive

This comment was marked as outdated.

Copy link
Collaborator

rust-highfive commented Sep 2, 2018

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (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.
[00:49:38] ...........i........................................................................................
[00:49:41] ....................................................................................................
[00:49:44] ....................................................................................................
[00:49:47] ....................................................................................................
[00:49:49] ...........................................i..................................F.F...................
[00:49:56] ....................................................................................................
[00:50:00] ................................................................................i...................
[00:50:03] ....................................................................................................
[00:50:07] ....................................................................................................
[00:50:07] ....................................................................................................
[00:50:09] ....................................................................................................
11] -    |                      ^^^^^^^^^^^^^^^^^ help: consider adding parenthesis: `((1 == 2) && false)`
[00:50:11] +    |                      ^^^^^^^^^^^^^^^^^ help: consider adding parentheses: `((1 == 2) && false)`
[00:50:11] 46    |
[00:50:11] -    = note: This will be a error until the `let_chains` feature is stabilized.
[00:50:11] +    = note: this will be a error until the `let_chains` feature is stabilized
[00:50:11] 49 error: aborting due to 6 previous errors
[00:50:11] 50 
[00:50:11] 
[00:50:11] 
[00:50:11] 
[00:50:11] The actual stderr differed from the expected stderr.
[00:50:11] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2015/syntax-ambiguity-2015.stderr
[00:50:11] To update references, rerun the tests and pass the `--bless` flag
[00:50:11] To only update this specific test, also pass `--test-args rfc-2497-if-let-chains/syntax-ambiguity-2015.rs`
[00:50:11] error: 1 errors occurred comparing output.
[00:50:11] status: exit code: 1
[00:50:11] status: exit code: 1
[00:50:11] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2015.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2015/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2015" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2497-if-let-chains/syntax-ambig0:11] {"message":"ambigious use of `&&`","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2015.rs","byte_start":1230,"byte_end":1247,"line_start":36,"line_end":36,"column_start":22,"column_end":39,"is_primary":true,"text":[{"text":"    while let true = (1 == 2) && false { }","highlight_start":22,"highlight_end":39}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"this will be a error until the `let_chains` feature is stabilized","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding parentheses","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2015.rs","byte_start":1230,"byte_end":1247,"line_start":36,"line_end":36,"column_start":22,"column_end":39,"is_primary":true,"text":[{"text":"    while let true = (1 == 2) && false { }","highlight_start":22,"highlight_end":39}],"label":null,"suggested_replacement":"((1 == 2) && false)","suggestion_applicability":"Unspecified","expansion":null}],"children":[],"rendered":null}],"rendered":"error: ambigious use of `&&`\n  --> /checkout/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2015.rs:36:22\n   |\nLL |     while let true = (1 == 2) && false { }\n   |                      ^^^^^^^^^^^^^^^^^ help: consider adding parentheses: `((1 == 2) && false)`\n   |\n   = note: this will be a error until the `let_chains` feature is stabilized\n\n"}
[00:50:11] {"message":"aborting due to 6 previous errors","code":null,"level":"error","spans":[],"children":[],"reis will be a error until the `let_chains` feature is stabilized.
[00:50:11] +    = note: this will be a error until the `let_chains` feature is stabilized
[00:50:11] 16 
[00:50:11] 17 error: ambigious use of `&&`
[00:50:11] 18   --> $DIR/syntax-ambiguity-2018.rs:27:50
[00:50:11] 19    |
[00:50:11] 19    |
[00:50:11] 20 LL |     while let Range { start: _, end: _ } = true..true && false { }
[00:50:11] -    |                                                  ^^^^^^^^^^^^^ help: consider adding parenthesis: `(true && false)`
[00:50:11] +    |                                                  ^^^^^^^^^^^^^ help: consider adding parentheses: `(true && false)`
[00:50:11] 22    |
[00:50:11] -    = note: This will be a error until the `let_chains` feature is stabilized.
[00:50:11] +    = note: this will be a error until the `let_chains` feature is stabilized
[00:50:11] 24 
[00:50:11] 25 error: ambigious use of `||`
[00:50:11] 26   --> $DIR/syntax-ambiguity-2018.rs:30:50
[00:50:11] 27    |
[00:50:11] 27    |
[00:50:11] 28 LL |     while let Range { start: _, end: _ } = true..true || false { }
[00:50:11] -    |                                                  ^^^^^^^^^^^^^ help: consider adding parenthesis: `(true || false)`
[00:50:11] +    |                                                  ^^^^^^^^^^^^^ help: consider adding parentheses: `(true || false)`
[00:50:11] 30    |
[00:50:11] -    = note: This will be a error until the `let_chains` feature is stabilized.
[00:50:11] +    = note: this will be a error until the `let_chains` feature is stabilized
[00:50:11] 32 
[00:50:11] 33 error: ambigious use of `&&`
[00:50:11] 34   st, also pass `--test-args rfc-2497-if-let-chains/syntax-ambiguity-2018.rs`
[00:50:11] error: 1 errors occurred comparing output.
[00:50:11] status: exit code: 1
[00:50:11] status: exit code: 1
[00:50:11] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2018.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2018/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2018" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2018/auxiliary" "-A" "unused"
[00:50:11] ------------------------------------------
[00:50:11] 
[00:50:11] ------------------------------------------
[00:50:11] stderr:
[00:50:11] stderr:
[00:50:11] ------------------------------------------
[00:50:11] {"message":"ambigious use of `&&`","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2018.rs","byte_start":766,"byte_end":779,"line_start":21,"line_end":21,"column_start":47,"column_end":60,"is_primary":true,"text":[{"text":"    if let Range { start: _, end: _ } = true..true && false { }","highlight_start":47,"highlight_end":60}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"this will be a error until the `let_chains` feature is stabilized","code":null,"level":"note","spans":[],"chil97-if-let-chains/syntax-ambiguity-2018.rs","byte_start":1152,"byte_end":1166,"line_start":33,"line_end":33,"column_start":19,"column_end":33,"is_primary":true,"text":[{"text":"    if let true = false && false { }","highlight_start":19,"highlight_end":33}],"label":null,"suggested_replacement":"(false && false)","suggestion_applicability":"Unspecified","expansion":null}],"children":[],"rendered":null}],"rendered":"error: ambigious use of `&&`\n  --> /checkout/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2018.rs:33:19\n   |\nLL |     if let true = false && false { }\n   |                   ^^^^^^^^^^^^^^ help: consider adding parentheses: `(false && false)`\n   |\n   = note: this will be a error until the `let_chains` feature is stabilized\n\n"}
[00:50:11] {"message":"ambigious use of `&&`","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2018.rs","byte_start":1230,"byte_end":1247,"line_start":36,"line_end":36,"column_start":22,"column_end":39,"is_primary":true,"text":[{"text":"    while let true = (1 == 2) && false { }","highlight_start":22,"highlight_end":39}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"this will be a error until the `let_chains` feature is stabilized","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider adding parentheses","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2018.rs","byte_start":1230,"byte_end":1247,"line_start":36,"line_end":36,"column_start":22,"column_obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps
35108 ./obj/build/x86_64-unknown-linux-gnu/doc/core/arch
34984 ./.git/modules/src/libcompiler_builtins/modules/compiler-rt
34916 ./obj/build/x86_64-unknown-linux-gnu/native/jemalloc/src
34600 ./obj/build/x86_64-unknown-linux-gnu/stage0-std/release/build
---
travis_time:end:0f554e7c:start=1535877786508657831,finish=1535877786515889220,duration=7231389
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:07ff816a
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!

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)

@davidtwco davidtwco force-pushed the davidtwco:issue-53668 branch from eb278a3 to 8c92cbe Sep 2, 2018

@davidtwco

This comment has been minimized.

Copy link
Member Author

davidtwco commented Sep 2, 2018

Oops, forgot to update the test output. Thought I'd forgot something. 🤦‍♂️

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Sep 4, 2018

@bors try

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Sep 4, 2018

⌛️ Trying commit 8c92cbe with merge 51ff957...

bors added a commit that referenced this pull request Sep 4, 2018

Auto merge of #53854 - davidtwco:issue-53668, r=<try>
WIP: if- and while-let-chains, take 2 - edition changes

Part of #53668.

r? @nikomatsakis
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Sep 4, 2018

☀️ Test successful - status-travis
State: approved= try=True

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Sep 5, 2018

@craterbot run start=master#1c2e17f4e3a2070a7f703f51e29c1c388ef703b6 end=try#51ff957df5095d92d1d3d4682207ee8b7ad408a8 mode=check-only

@craterbot

This comment has been minimized.

Copy link
Collaborator

craterbot commented Sep 5, 2018

👌 Experiment pr-53854 created and queued.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot

This comment has been minimized.

Copy link
Collaborator

craterbot commented Sep 5, 2018

🚧 Experiment pr-53854 is now running on agent aws-2.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot

This comment has been minimized.

Copy link
Collaborator

craterbot commented Sep 6, 2018

🎉 Experiment pr-53854 is completed!
📰 Open the full report.

⚠️ If you notice any spurious failure please add them to the blacklist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@Centril

This comment has been minimized.

Copy link
Contributor

Centril commented Sep 6, 2018

The good news is that crater found zero real regressions :)

@nikomatsakis nikomatsakis changed the title WIP: if- and while-let-chains, take 2 - edition changes if- and while-let-chains, take 2 - edition changes Sep 6, 2018

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Sep 7, 2018

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Sep 7, 2018

📌 Commit 0a8cf67 has been approved by nikomatsakis

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Sep 8, 2018

⌛️ Testing commit 0a8cf67 with merge 748cca4...

bors added a commit that referenced this pull request Sep 8, 2018

Auto merge of #53854 - davidtwco:issue-53668, r=nikomatsakis
if- and while-let-chains, take 2 - edition changes

Part of #53668.

r? @nikomatsakis
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Sep 8, 2018

💔 Test failed - status-appveyor

@kennytm

This comment has been minimized.

Copy link
Member

kennytm commented Sep 9, 2018

@bors retry

note: C:/projects/rust/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot open output file C:\\projects\\rust\\build\\i686-pc-windows-gnu\\test\\ui\\issues\\issue-19100\\a.exe: Permission denied

Feels spurious.

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Sep 10, 2018

⌛️ Testing commit 0a8cf67 with merge fb945f0...

bors added a commit that referenced this pull request Sep 10, 2018

Auto merge of #53854 - davidtwco:issue-53668, r=nikomatsakis
if- and while-let-chains, take 2 - edition changes

Part of #53668.

r? @nikomatsakis
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Sep 10, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing fb945f0 to master...

@bors bors merged commit 0a8cf67 into rust-lang:master Sep 10, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details

@davidtwco davidtwco deleted the davidtwco:issue-53668 branch Sep 10, 2018

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.