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

driver: set the syntax edition in phase 1 #53226

Merged
merged 1 commit into from
Aug 14, 2018

Conversation

QuietMisdreavus
Copy link
Member

Fixes #53203

It seems the way libsyntax handles the desired edition is to use a global, set via syntax_pos::hygiene::set_default_edition. Right now, this is set in the driver in run_compiler, which is the entry point for running the compiler all the way through to emitting files. Since rustdoc doesn't use this function, it wasn't properly setting this global. (When initially setting up editions in rustdoc, i'd assumed that setting sessopts.edition would have done this... >_>) This was "fixed" for doctests in #52385, but rather than patching in a call to set_default_edition in all the places rustdoc sets up the compiler, i've instead moved the call in the driver to be farther in the process. This means that any use of phase_1_parse_input with the right session options will have the edition properly set without having to also remember to set libsyntax up separately.

r? @rust-lang/compiler

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 9, 2018
@petrochenkov petrochenkov self-assigned this Aug 9, 2018
@estebank
Copy link
Contributor

estebank commented Aug 9, 2018

@bors r+

@bors
Copy link
Contributor

bors commented Aug 9, 2018

📌 Commit 0511b01 has been approved by estebank

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 9, 2018
kennytm added a commit to kennytm/rust that referenced this pull request Aug 14, 2018
…=estebank

driver: set the syntax edition in phase 1

Fixes rust-lang#53203

It seems the way libsyntax handles the desired edition is to use a global, set via `syntax_pos::hygiene::set_default_edition`. Right now, this is set in the driver in `run_compiler`, which is the entry point for running the compiler all the way through to emitting files. Since rustdoc doesn't use this function, it wasn't properly setting this global. (When initially setting up editions in rustdoc, i'd assumed that setting `sessopts.edition` would have done this... `>_>`) This was "fixed" for doctests in rust-lang#52385, but rather than patching in a call to `set_default_edition` in all the places rustdoc sets up the compiler, i've instead moved the call in the driver to be farther in the process. This means that any use of `phase_1_parse_input` with the right session options will have the edition properly set without having to also remember to set libsyntax up separately.

r? @rust-lang/compiler
bors added a commit that referenced this pull request Aug 14, 2018
Rollup of 11 pull requests

Successful merges:

 - #53112 (pretty print BTreeSet)
 - #53208 (Don't panic on std::env::vars() when env is null.)
 - #53226 (driver: set the syntax edition in phase 1)
 - #53229 (Make sure rlimit is only ever increased)
 - #53233 (targets: aarch64: Add bare-metal aarch64 target)
 - #53239 (rustc_codegen_llvm: Restore the closure env alloca hack for LLVM 5.)
 - #53246 (A few cleanups)
 - #53257 (Idiomatic improvements to IP method)
 - #53274 (Remove statics field from CodegenCx)
 - #53290 (Make LLVM emit assembly comments with -Z asm-comments)
 - #53317 (Mark prior failure to avoid ICE)
@bors bors merged commit 0511b01 into rust-lang:master Aug 14, 2018
@QuietMisdreavus QuietMisdreavus deleted the editions-for-all branch August 15, 2018 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rustdoc: issues with some async syntax
5 participants