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

parse: towards unified fn grammar #68788

Merged
merged 4 commits into from
Feb 6, 2020
Merged

Conversation

Centril
Copy link
Contributor

@Centril Centril commented Feb 3, 2020

Part of #68728.

  • Syntactically, fn items in extern { ... } blocks can now have bodies (fn foo() { ... } as opposed to fn foo();). As above, we use semantic restrictions instead.

  • Syntactically, fn items in free contexts (directly in a file or a module) can now be without bodies (fn foo(); as opposed to fn foo() { ... }. As above, we use semantic restrictions instead, including for non-ident parameter patterns.

  • We move towards unifying the fn front matter; this is fully realized in parse: merge fn syntax + cleanup item parsing #68728.

r? @petrochenkov

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 3, 2020
src/librustc_ast_passes/ast_validation.rs Outdated Show resolved Hide resolved
src/librustc_ast_passes/ast_validation.rs Outdated Show resolved Hide resolved
src/librustc_ast_passes/ast_validation.rs Outdated Show resolved Hide resolved
src/librustc_ast_passes/ast_validation.rs Outdated Show resolved Hide resolved
src/librustc_ast_passes/ast_validation.rs Outdated Show resolved Hide resolved
@petrochenkov petrochenkov 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 Feb 3, 2020
@Centril
Copy link
Contributor Author

Centril commented Feb 3, 2020

Addressed the comments & squashed into last commit.

@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Feb 3, 2020

📌 Commit 31026e814b2a2b8ba810f1bbe6cd5cb94c369e15 has been approved by petrochenkov

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 3, 2020
@bors
Copy link
Contributor

bors commented Feb 4, 2020

⌛ Testing commit 31026e814b2a2b8ba810f1bbe6cd5cb94c369e15 with merge f81b49be0be349edc325eedb52330a72a1ce2f77...

@rust-highfive
Copy link
Collaborator

The job dist-x86_64-linux-alt 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.
2020-02-04T10:52:14.6170579Z     |
2020-02-04T10:52:14.6170970Z     = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
2020-02-04T10:52:14.6173798Z 
2020-02-04T10:52:14.9409925Z [RUSTC-TIMING] rustc_builtin_macros test:false 4.245
2020-02-04T10:52:22.7219184Z error[E0275]: overflow evaluating the requirement `std::ptr::Unique<syntax::ast::Path>: std::marker::Sync`
2020-02-04T10:52:22.7220687Z   |
2020-02-04T10:52:22.7221476Z   = help: consider adding a `#![recursion_limit="256"]` attribute to your crate
2020-02-04T10:52:22.7222259Z   = note: required because it appears within the type `std::boxed::Box<syntax::ast::Path>`
2020-02-04T10:52:22.7223814Z   = note: required because it appears within the type `syntax::ast::VisibilityKind`
2020-02-04T10:52:22.7224735Z   = note: required because it appears within the type `rustc_span::source_map::Spanned<syntax::ast::VisibilityKind>`
2020-02-04T10:52:22.7225491Z   = note: required because it appears within the type `syntax::ast::Item`
2020-02-04T10:52:22.7226285Z   = note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<syntax::ast::Item>`
2020-02-04T10:52:22.7226285Z   = note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<syntax::ast::Item>`
2020-02-04T10:52:22.7227055Z   = note: required because it appears within the type `std::boxed::Box<syntax::ast::Item>`
2020-02-04T10:52:22.7227813Z   = note: required because it appears within the type `syntax::ptr::P<syntax::ast::Item>`
2020-02-04T10:52:22.7228527Z   = note: required because it appears within the type `syntax::token::Nonterminal`
2020-02-04T10:52:22.7229317Z   = note: required because of the requirements on the impl of `std::marker::Sync` for `std::sync::Arc<syntax::token::Nonterminal>`
2020-02-04T10:52:22.7232252Z   = note: required because it appears within the type `syntax::token::Token`
2020-02-04T10:52:22.7233186Z   = note: required because it appears within the type `syntax::tokenstream::TokenTree`
2020-02-04T10:52:22.7233186Z   = note: required because it appears within the type `syntax::tokenstream::TokenTree`
2020-02-04T10:52:22.7234054Z   = note: required because it appears within the type `(syntax::tokenstream::TokenTree, syntax::tokenstream::IsJoint)`
2020-02-04T10:52:22.7234966Z   = note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<(syntax::tokenstream::TokenTree, syntax::tokenstream::IsJoint)>`
2020-02-04T10:52:22.7235836Z   = note: required because it appears within the type `alloc::raw_vec::RawVec<(syntax::tokenstream::TokenTree, syntax::tokenstream::IsJoint)>`
2020-02-04T10:52:22.7237229Z   = note: required because it appears within the type `std::vec::Vec<(syntax::tokenstream::TokenTree, syntax::tokenstream::IsJoint)>`
2020-02-04T10:52:22.7238205Z   = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc<std::vec::Vec<(syntax::tokenstream::TokenTree, syntax::tokenstream::IsJoint)>>`
2020-02-04T10:52:22.7239468Z   = note: required because it appears within the type `syntax::ast::MacArgs`
2020-02-04T10:52:22.7239468Z   = note: required because it appears within the type `syntax::ast::MacArgs`
2020-02-04T10:52:22.7240116Z   = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<syntax::ast::MacArgs>`
2020-02-04T10:52:22.7240947Z   = note: required because it appears within the type `std::boxed::Box<syntax::ast::MacArgs>`
2020-02-04T10:52:22.7241570Z   = note: required because it appears within the type `syntax::ptr::P<syntax::ast::MacArgs>`
2020-02-04T10:52:22.7242832Z   = note: required because it appears within the type `syntax::ast::PatKind`
2020-02-04T10:52:22.7243468Z   = note: required because it appears within the type `syntax::ast::Pat`
2020-02-04T10:52:22.7244142Z   = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<syntax::ast::Pat>`
2020-02-04T10:52:22.7244795Z   = note: required because it appears within the type `std::boxed::Box<syntax::ast::Pat>`
---
2020-02-04T10:52:22.7251290Z   = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<syntax::ast::Ty>`
2020-02-04T10:52:22.7251928Z   = note: required because it appears within the type `std::boxed::Box<syntax::ast::Ty>`
2020-02-04T10:52:22.7252563Z   = note: required because it appears within the type `syntax::ptr::P<syntax::ast::Ty>`
2020-02-04T10:52:22.7271626Z   = note: required because it appears within the type `syntax::ast::GenericArg`
2020-02-04T10:52:22.7272390Z   = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<syntax::ast::GenericArg>`
2020-02-04T10:52:22.7273028Z   = note: required because it appears within the type `alloc::raw_vec::RawVec<syntax::ast::GenericArg>`
2020-02-04T10:52:22.7273655Z   = note: required because it appears within the type `std::vec::Vec<syntax::ast::GenericArg>`
2020-02-04T10:52:22.7278079Z   = note: required because it appears within the type `syntax::ast::AngleBracketedArgs`
2020-02-04T10:52:22.7279703Z   = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<syntax::ast::GenericArgs>`
2020-02-04T10:52:22.7280390Z   = note: required because it appears within the type `std::boxed::Box<syntax::ast::GenericArgs>`
2020-02-04T10:52:22.7281205Z   = note: required because it appears within the type `syntax::ptr::P<syntax::ast::GenericArgs>`
2020-02-04T10:52:22.7281945Z   = note: required because it appears within the type `std::option::Option<syntax::ptr::P<syntax::ast::GenericArgs>>`
---
2020-02-04T10:52:26.9643152Z     Checking rustc_codegen_utils v0.0.0 (/checkout/src/librustc_codegen_utils)
2020-02-04T10:52:26.9947051Z error: Could not document `rustc_ast_lowering`.
2020-02-04T10:52:26.9948028Z 
2020-02-04T10:52:26.9948869Z Caused by:
2020-02-04T10:52:26.9954646Z   process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustdoc --edition=2018 --crate-type lib --crate-name rustc_ast_lowering src/librustc_ast_lowering/lib.rs --target x86_64-unknown-linux-gnu -o /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/doc --error-format=json --json=diagnostic-rendered-ansi -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/release/deps --extern log=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/liblog-4a57237387b77b3e.rmeta --extern rustc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc-da6c3e1b18511131.rmeta --extern rustc_ast_pretty=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_ast_pretty-dc4da9d9bdcfcd3e.rmeta --extern rustc_data_structures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_data_structures-aed95ce3c2cbc0b5.rmeta --extern rustc_errors=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_errors-bc6a7be3780a271e.rmeta --extern rustc_hir=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_hir-c185f352ba334eed.rmeta --extern rustc_index=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_index-e414e969ff2a637d.rmeta --extern rustc_session=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_session-ed182a2a16af924b.rmeta --extern rustc_span=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_span-4906c325a2df8ef8.rmeta --extern rustc_target=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_target-6f02fa7aae2cc6b0.rmeta --extern smallvec=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libsmallvec-cc09ca1932427855.rmeta --extern syntax=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax-a920d54ce271da24.rmeta --document-private-items` (exit code: 1)
2020-02-04T10:52:27.5696387Z [RUSTC-TIMING] rustc_codegen_utils test:false 0.598
2020-02-04T10:52:49.9170331Z warning: `[E0502]` cannot be resolved, ignoring it.
2020-02-04T10:52:49.9171663Z    --> src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs:572:37
2020-02-04T10:52:49.9172359Z     |
---
2020-02-04T10:52:50.6576870Z 
2020-02-04T10:52:51.4864352Z error: build failed
2020-02-04T10:52:51.4895276Z 
2020-02-04T10:52:51.4896638Z 
2020-02-04T10:52:51.4899576Z 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" "doc" "-Zconfig-profile" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "2" "--release" "--locked" "--color" "always" "--features" "jemalloc llvm" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--no-deps" "-p" "rustc_index" "-p" "rustc_plugin_impl" "-p" "rustc_feature" "-p" "rustc_typeck" "-p" "rustc_incremental" "-p" "arena" "-p" "rustc_lint" "-p" "rustc_mir" "-p" "graphviz" "-p" "rustc_ast_passes" "-p" "rustc_interface" "-p" "rustc_apfloat" "-p" "serialize" "-p" "rustc_target" "-p" "rustc_data_structures" "-p" "rustc_ty" "-p" "rustc_codegen_ssa" "-p" "rustc_errors" "-p" "fmt_macros" "-p" "rustc_attr" "-p" "rustc_mir_build" "-p" "rustc_metadata" "-p" "rustc_ast_lowering" "-p" "rustc_driver" "-p" "rustc_hir" "-p" "rustc_fs_util" "-p" "rustc_parse" "-p" "rustc_lexer" "-p" "syntax" "-p" "rustc_ast_pretty" "-p" "rustc_error_codes" "-p" "rustc" "-p" "rustc_codegen_utils" "-p" "rustc_save_analysis" "-p" "rustc_macros" "-p" "rustc_expand" "-p" "rustc_resolve" "-p" "rustc_passes" "-p" "rustc_codegen_llvm" "-p" "rustc_session" "-p" "rustc_llvm" "-p" "build_helper" "-p" "rustc_span" "-p" "rustc_builtin_macros" "-p" "rustc_privacy" "-p" "rustc_traits"
2020-02-04T10:52:51.4900292Z 
2020-02-04T10:52:51.4900333Z 
2020-02-04T10:52:51.4909949Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap dist --host x86_64-unknown-linux-gnu --target x86_64-unknown-linux-gnu
2020-02-04T10:52:51.4910330Z Build completed unsuccessfully in 1:42:02
2020-02-04T10:52:51.4910330Z Build completed unsuccessfully in 1:42:02
2020-02-04T10:52:51.4960097Z == clock drift check ==
2020-02-04T10:52:51.4974872Z   local time: Tue Feb  4 10:52:51 UTC 2020
2020-02-04T10:52:51.9776491Z   network time: Tue, 04 Feb 2020 10:52:51 GMT
2020-02-04T10:52:51.9777348Z == end clock drift check ==
2020-02-04T10:52:53.2296710Z 
2020-02-04T10:52:53.2405483Z ##[error]Bash exited with code '1'.
2020-02-04T10:52:53.2451280Z ##[section]Starting: Checkout rust-lang/rust@auto to s
2020-02-04T10:52:53.2453491Z ==============================================================================
2020-02-04T10:52:53.2453609Z Task         : Get sources
2020-02-04T10:52:53.2453715Z 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)

@bors
Copy link
Contributor

bors commented Feb 4, 2020

💔 Test failed - checks-azure

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 4, 2020
@petrochenkov petrochenkov 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 Feb 4, 2020
@Centril
Copy link
Contributor Author

Centril commented Feb 5, 2020

Added #![recursion_limit="256"] to lowering, @bors r=petrochenkov

@bors
Copy link
Contributor

bors commented Feb 5, 2020

📌 Commit ddb9e9b2525e73baf2e9e5d9d8cfdd32eb9ed628 has been approved by petrochenkov

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 5, 2020
@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.
2020-02-05T01:05:00.0349215Z ========================== Starting Command Output ===========================
2020-02-05T01:05:00.0351919Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/ec8f368d-9be0-4d3b-95de-9980af4cb39f.sh
2020-02-05T01:05:00.0352070Z 
2020-02-05T01:05:00.0354917Z ##[section]Finishing: Disable git automatic line ending conversion
2020-02-05T01:05:00.0360830Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/68788/merge to s
2020-02-05T01:05:00.0362453Z Task         : Get sources
2020-02-05T01:05:00.0362530Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-02-05T01:05:00.0362568Z Version      : 1.0.0
2020-02-05T01:05:00.0362605Z Author       : Microsoft
---
2020-02-05T01:05:00.9913936Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-02-05T01:05:00.9996659Z ##[command]git config gc.auto 0
2020-02-05T01:05:01.0083997Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-02-05T01:05:01.0131520Z ##[command]git config --get-all http.proxy
2020-02-05T01:05:01.0281382Z ##[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/68788/merge:refs/remotes/pull/68788/merge

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)

@Centril Centril added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 5, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Feb 5, 2020
On suggesting `#![recursion_limit = "X"]`, note current crate name

This would have saved me much confusion e.g. when reading the log output in rust-lang#68788 (comment).

r? @estebank
@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Feb 5, 2020

📌 Commit 9a4eac3 has been approved by petrochenkov

@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 Feb 5, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Feb 6, 2020
…henkov

Towards unified `fn` grammar

Part of rust-lang#68728.

- Syntactically, `fn` items in `extern { ... }` blocks can now have bodies (`fn foo() { ... }` as opposed to `fn foo();`). As above, we use semantic restrictions instead.

- Syntactically, `fn` items in free contexts (directly in a file or a module) can now be without bodies (`fn foo();` as opposed to `fn foo() { ... }`. As above, we use semantic restrictions instead, including for non-ident parameter patterns.

- We move towards unifying the `fn` front matter; this is fully realized in rust-lang#68728.

r? @petrochenkov
bors added a commit that referenced this pull request Feb 6, 2020
Rollup of 9 pull requests

Successful merges:

 - #68691 (Remove `RefCell` usage from `ObligationForest`.)
 - #68751 (Implement `unused_parens` for `const` and `static` items)
 - #68788 (Towards unified `fn` grammar)
 - #68837 (Make associated item collection a query)
 - #68842 (or_patterns: add regression test for #68785)
 - #68844 (use def_path_str for missing_debug_impls message)
 - #68845 (stop using BytePos for computing spans in librustc_parse/parser/mod.rs)
 - #68869 (clean up E0271 explanation)
 - #68880 (Forbid using `0` as issue number)

Failed merges:

r? @ghost
@bors bors merged commit 9a4eac3 into rust-lang:master Feb 6, 2020
flip1995 added a commit to flip1995/rust-clippy that referenced this pull request Feb 6, 2020
flip1995 added a commit to flip1995/rust-clippy that referenced this pull request Feb 6, 2020
bors added a commit to rust-lang/rust-clippy that referenced this pull request Feb 6, 2020
bors added a commit to rust-lang/rust-clippy that referenced this pull request Feb 6, 2020
@Centril Centril deleted the unified-fn-bodies branch February 6, 2020 21:19
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Feb 28, 2020
late resolve, visit_fn: bail early if there's no body.

Fixes rust-lang#69401 which was injected by rust-lang@b2c6eeb in rust-lang#68788.

r? @petrochenkov
Centril added a commit to Centril/rust that referenced this pull request Feb 28, 2020
late resolve, visit_fn: bail early if there's no body.

Fixes rust-lang#69401 which was injected by rust-lang@b2c6eeb in rust-lang#68788.

r? @petrochenkov
@Centril Centril added the relnotes Marks issues that should be documented in the release notes of the next release. label Mar 24, 2020
@Centril Centril added this to the 1.43 milestone Mar 24, 2020
@Centril Centril added the T-lang Relevant to the language team, which will review and decide on the PR/issue. label Mar 24, 2020
@Centril Centril changed the title Towards unified fn grammar parse: towards unified fn grammar Mar 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants