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

Refactor with {ast, hir, hair::pattern}::Binding #67620

Closed
wants to merge 9 commits into from

Conversation

Centril
Copy link
Contributor

@Centril Centril commented Dec 25, 2019

Instead of having the binding information directly inside PatKind::Binding(...), we move everything to the left of @ into a struct Binding (for each IR).

Also, we rename ast::PatKind::Ident to ast::PatKind::Binding.

r? @oli-obk

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-7 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-25T21:15:46.8754141Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-12-25T21:15:46.8936197Z ##[command]git config gc.auto 0
2019-12-25T21:15:46.9003804Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-12-25T21:15:46.9052170Z ##[command]git config --get-all http.proxy
2019-12-25T21:15:46.9186160Z ##[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/67620/merge:refs/remotes/pull/67620/merge
---
2019-12-25T22:10:01.7539555Z .................................................................................................... 1600/9451
2019-12-25T22:10:06.8636437Z .................................................................................................... 1700/9451
2019-12-25T22:10:15.1160490Z ...........................................................................................i........ 1800/9451
2019-12-25T22:10:21.6460305Z .................................................................................................... 1900/9451
2019-12-25T22:10:27.4576184Z .............................................................................iiiii.................. 2000/9451
2019-12-25T22:10:46.6878243Z .................................................................................................... 2200/9451
2019-12-25T22:10:48.7410323Z .................................................................................................... 2300/9451
2019-12-25T22:10:50.9364762Z .................................................................................................... 2400/9451
2019-12-25T22:10:59.2496348Z .................................................................................................... 2500/9451
---
2019-12-25T22:13:35.0504033Z ........i...............i........................................................................... 4900/9451
2019-12-25T22:13:43.9744976Z .................................................................................................... 5000/9451
2019-12-25T22:13:48.5699997Z ....................................................i............................................... 5100/9451
2019-12-25T22:13:57.0345504Z .................................................................................................... 5200/9451
2019-12-25T22:14:02.6345313Z ...................ii.ii...........i................................................................ 5300/9451
2019-12-25T22:14:10.6166437Z .................................................................................................... 5500/9451
2019-12-25T22:14:20.4841485Z .................................................................................................... 5600/9451
2019-12-25T22:14:27.3953660Z .i.................................................................................................. 5700/9451
2019-12-25T22:14:32.1281185Z .................................................................................................... 5800/9451
2019-12-25T22:14:32.1281185Z .................................................................................................... 5800/9451
2019-12-25T22:14:40.8879469Z .........................................................................................ii...i..ii. 5900/9451
2019-12-25T22:15:00.9299913Z .................................................................................................... 6100/9451
2019-12-25T22:15:08.1886026Z .................................................................................................... 6200/9451
2019-12-25T22:15:15.3418270Z .................................................................................................... 6300/9451
2019-12-25T22:15:15.3418270Z .................................................................................................... 6300/9451
2019-12-25T22:15:28.2928894Z ................i..ii............................................................................... 6400/9451
2019-12-25T22:15:45.8293773Z ............................................................................................i....... 6600/9451
2019-12-25T22:15:47.6263629Z .................................................................................................... 6700/9451
2019-12-25T22:15:49.5996901Z ............................................................................................i....... 6800/9451
2019-12-25T22:15:51.9111346Z .................................................................................................... 6900/9451
---
2019-12-25T22:17:19.7381853Z .................................................................................................... 7500/9451
2019-12-25T22:17:23.9374549Z .................................................................................................... 7600/9451
2019-12-25T22:17:30.1231606Z .................................................................................................... 7700/9451
2019-12-25T22:17:39.3991892Z .................................................................................................... 7800/9451
2019-12-25T22:17:45.1657373Z ......................iiii.......................................................................... 7900/9451
2019-12-25T22:17:58.0168983Z .................................................................................................... 8100/9451
2019-12-25T22:18:07.3692967Z .................................................................................................... 8200/9451
2019-12-25T22:18:19.3677620Z .................................................................................................... 8300/9451
2019-12-25T22:18:25.4819028Z .................................................................................................... 8400/9451
---
2019-12-25T22:20:31.6596328Z  finished in 6.156
2019-12-25T22:20:31.6787488Z Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-12-25T22:20:31.8242593Z 
2019-12-25T22:20:31.8243372Z running 166 tests
2019-12-25T22:20:34.6086559Z iiii......i........ii..iiii...i.............................i..i..................i....i............ 100/166
2019-12-25T22:20:36.5212197Z i.i.i...iii..iiiiiii.......................iii............ii......
2019-12-25T22:20:36.5215461Z 
2019-12-25T22:20:36.5223136Z  finished in 4.843
2019-12-25T22:20:36.5404478Z Check compiletest suite=codegen-units mode=codegen-units (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-12-25T22:20:36.6934490Z 
---
2019-12-25T22:20:38.4509733Z  finished in 1.910
2019-12-25T22:20:38.4680809Z Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-12-25T22:20:38.6108144Z 
2019-12-25T22:20:38.6108247Z running 9 tests
2019-12-25T22:20:38.6108791Z iiiiiiiii
2019-12-25T22:20:38.6109462Z 
2019-12-25T22:20:38.6109528Z  finished in 0.142
2019-12-25T22:20:38.6268861Z Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-12-25T22:20:38.7747559Z 
---
2019-12-25T22:20:56.3328275Z  finished in 17.705
2019-12-25T22:20:56.3505892Z Check compiletest suite=debuginfo mode=debuginfo-gdb+lldb (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-12-25T22:20:56.5002987Z 
2019-12-25T22:20:56.5003370Z running 124 tests
2019-12-25T22:21:18.6678225Z .iiiii..ii.....i..i...i..i.i.i..i..i..iii....ii.ii....ii..........iiii..........i.....i..ii.......ii 100/124
2019-12-25T22:21:22.4238807Z .i.iii.....iiiiii.....ii
2019-12-25T22:21:22.4241336Z 
2019-12-25T22:21:22.4241581Z  finished in 26.069
2019-12-25T22:21:22.4242135Z Uplifting stage1 rustc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-12-25T22:21:22.4242719Z Copying stage2 rustc from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
---
2019-12-25T22:33:21.2907959Z 
2019-12-25T22:33:21.2908891Z    Doc-tests core
2019-12-25T22:33:25.3470310Z 
2019-12-25T22:33:25.3471070Z running 2439 tests
2019-12-25T22:33:33.5805921Z ......iiiii......................................................................................... 100/2439
2019-12-25T22:33:41.6875701Z ..................................................................................ii................ 200/2439
2019-12-25T22:34:00.5381475Z ................i................................................................................... 400/2439
2019-12-25T22:34:00.5381475Z ................i................................................................................... 400/2439
2019-12-25T22:34:09.0104276Z ................................................................i..i..................iiii.......... 500/2439
2019-12-25T22:34:23.9941346Z .................................................................................................... 700/2439
2019-12-25T22:34:31.7609417Z .................................................................................................... 800/2439
2019-12-25T22:34:39.6378496Z .................................................................................................... 900/2439
2019-12-25T22:34:47.3906748Z .................................................................................................... 1000/2439
---
2019-12-25T22:38:12.0220068Z 
2019-12-25T22:38:12.0254957Z running 1003 tests
2019-12-25T22:38:28.4530837Z i................................................................................................... 100/1003
2019-12-25T22:38:37.5417164Z .................................................................................................... 200/1003
2019-12-25T22:38:44.0221410Z ..................iii......i......i...i......i...................................................... 300/1003
2019-12-25T22:38:48.3941224Z .................................................................................................... 400/1003
2019-12-25T22:38:54.4979375Z ..........................................i..i.....................................ii............... 500/1003
2019-12-25T22:39:05.9589484Z .................................................................................................... 700/1003
2019-12-25T22:39:05.9589484Z .................................................................................................... 700/1003
2019-12-25T22:39:11.7962231Z .............................iiii................................................................... 800/1003
2019-12-25T22:39:25.2924255Z .................................................................................................... 900/1003
2019-12-25T22:39:31.0593124Z ...................................................iiii............................................. 1000/1003
2019-12-25T22:39:31.1738771Z test result: ok. 983 passed; 0 failed; 20 ignored; 0 measured; 0 filtered out
2019-12-25T22:39:31.1738855Z 
2019-12-25T22:39:31.1844942Z  finished in 163.917
2019-12-25T22:39:31.1858020Z Testing term stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
---
2019-12-25T22:42:55.4248845Z    Compiling syntax_expand v0.0.0 (/checkout/src/libsyntax_expand)
2019-12-25T22:42:55.6790207Z error[E0532]: expected tuple struct or tuple variant, found struct `ast::Binding`
2019-12-25T22:42:55.6791124Z    --> src/libsyntax_expand/parse/tests.rs:169:37
2019-12-25T22:42:55.6791504Z     |
2019-12-25T22:42:55.6791945Z 169 |         fn visit_binding(&mut self, ast::Binding(_, ast::Ident { span, .. }): &'a ast::Binding) {
2019-12-25T22:42:55.6792383Z     |                                     ^^^^^^^^^^^^ did you mean `ast::Binding { /* fields */ }`?
2019-12-25T22:42:55.6793071Z help: possible better candidate is found in another module, you can import it into scope
2019-12-25T22:42:55.6793361Z     |
2019-12-25T22:42:55.6793722Z 1   | use syntax::ast::PatKind::Binding;
2019-12-25T22:42:55.6794016Z     |
2019-12-25T22:42:55.6794016Z     |
2019-12-25T22:42:55.6794152Z 
2019-12-25T22:42:55.7202275Z error: unused import: `PatKind`
2019-12-25T22:42:55.7203235Z  --> src/libsyntax_expand/parse/tests.rs:5:31
2019-12-25T22:42:55.7203641Z   |
2019-12-25T22:42:55.7204230Z 5 | use syntax::ast::{self, Name, PatKind};
2019-12-25T22:42:55.7204976Z   |
2019-12-25T22:42:55.7205858Z   = note: `-D unused-imports` implied by `-D warnings`
2019-12-25T22:42:55.7206034Z 
2019-12-25T22:42:56.6526960Z error: aborting due to 2 previous errors
2019-12-25T22:42:56.6526960Z error: aborting due to 2 previous errors
2019-12-25T22:42:56.6527953Z 
2019-12-25T22:42:56.6528641Z For more information about this error, try `rustc --explain E0532`.
2019-12-25T22:42:56.6660979Z error: could not compile `syntax_expand`.
2019-12-25T22:42:57.3481743Z 
2019-12-25T22:42:57.3483368Z To learn more, run the command again with --verbose.
2019-12-25T22:42:57.3483705Z 
2019-12-25T22:42:57.3483888Z 
2019-12-25T22:42:57.3484881Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "-Zconfig-profile" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "2" "--release" "--locked" "--color" "always" "--features" " llvm" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "-p" "syntax_expand" "--" "--quiet"
2019-12-25T22:42:57.3485205Z 
2019-12-25T22:42:57.3485311Z 
2019-12-25T22:42:57.3485454Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-12-25T22:42:57.3485737Z Build completed unsuccessfully in 1:20:45
2019-12-25T22:42:57.3485737Z Build completed unsuccessfully in 1:20:45
2019-12-25T22:42:57.3486036Z == clock drift check ==
2019-12-25T22:42:57.3486170Z   local time: Wed Dec 25 22:42:56 UTC 2019
2019-12-25T22:42:57.3486297Z   network time: Wed, 25 Dec 2019 22:42:57 GMT
2019-12-25T22:42:57.3486419Z == end clock drift check ==
2019-12-25T22:42:57.8237820Z 
2019-12-25T22:42:57.8355318Z ##[error]Bash exited with code '1'.
2019-12-25T22:42:57.8387255Z ##[section]Starting: Checkout
2019-12-25T22:42:57.8388998Z ==============================================================================
2019-12-25T22:42:57.8389041Z Task         : Get sources
2019-12-25T22:42:57.8389096Z 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)

@JohnTitor JohnTitor added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 26, 2019
@bors
Copy link
Contributor

bors commented Dec 27, 2019

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

@petrochenkov
Copy link
Contributor

The story behind ast::PatKind::Ident is that it's not necessarily a binding, it may be a const or unit struct pattern as well, but we don't know it until resolve.
So it has a "syntactic" name (Ident) rather than semantic (Binding).

However, given that multiple syntactic things that are not necessarily identifiers (like ref ident or ident @ PAT) are merged into ast::PatKind::Ident, it's not a perfect name either.
So it should be ok to "lie in the other direction" and rename it to Binding even if it's not necessarily binding.

@petrochenkov
Copy link
Contributor

Not sure what is the motivation behind the introduction of the Binding struct, it's not clear from this PR. Looks like some code re-hashing, but not an improvement.

@JohnCSimon JohnCSimon added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 18, 2020
@joelpalmer
Copy link

Triaged

@joelpalmer joelpalmer added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 23, 2020
@joelpalmer joelpalmer added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 2, 2020
@joelpalmer joelpalmer added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 14, 2020
@Dylan-DPC-zz
Copy link

Closing this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants