about summary refs log tree commit diff
path: root/src/test/ui/thinlto
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-05-19 16:48:12 +0000
committerbors <bors@rust-lang.org>2019-05-19 16:48:12 +0000
commit6afcb5628523b0baae5704ad34ac1aba8ba10de6 (patch)
treebe7f566cc3158762e9b724045fd62c8d997731b5 /src/test/ui/thinlto
parente7591c1ae513537c23d4f911245b13bed9022343 (diff)
parent76b49007f3400a6bc5af5586c2a31121c2525568 (diff)
downloadrust-6afcb5628523b0baae5704ad34ac1aba8ba10de6.tar.gz
rust-6afcb5628523b0baae5704ad34ac1aba8ba10de6.zip
Auto merge of #60065 - QuietMisdreavus:async-move-doctests, r=ollie27
rustdoc: set the default edition when pre-parsing a doctest

Fixes https://github.com/rust-lang/rust/issues/59313 (possibly more? i think we've had issues with parsing edition-specific syntax in doctests at some point)

When handling a doctest, rustdoc needs to parse it beforehand, so that it can see whether it declares a `fn main` or `extern crate my_crate` explicitly. However, while doing this, rustdoc doesn't set the "default edition" used by the parser like the regular compilation runs do. This caused a problem when parsing a doctest with an `async move` block in it, since it was expecting the `move` keyword to start a closure, not a block.

This PR changes the `rustdoc::test::make_test` function to set the parser's default edition while looking for a main function and `extern crate` statement. However, to do this, `make_test` needs to know what edition to set. Since this is also used during the HTML rendering process (to make playground URLs), now the HTML renderer needs to know about the default edition. Upshot: rendering standalone markdown files can now accept a "default edition" for their doctests with the `--edition` flag! (I'm pretty sure i waffled around how to set that a long time ago when we first added the `--edition` flag... `>_>`)

I'm posting this before i stop for the night so that i can write this description while it's still in my head, but before this merges i want to make sure that (1) the `rustdoc-ui/failed-doctest-output` test still works (i expect it doesn't), and (2) i add a test with the sample from the linked issue.
Diffstat (limited to 'src/test/ui/thinlto')
0 files changed, 0 insertions, 0 deletions