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

Playground links from code blocks in books need to obey edition2018 flag #58491

Closed
rchaser53 opened this issue Feb 15, 2019 · 8 comments
Closed
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@rchaser53
Copy link
Contributor

rchaser53 commented Feb 15, 2019

EDIT: The error here is actually from clicking the playground link, not that there's a problem with the code, or how the book's testpass is running. Original description follows.


It seems that #![feature(try_blocks)] is not worked now.
link: https://doc.rust-lang.org/unstable-book/language-features/try-blocks.html

build_failed

@Centril Centril added C-bug Category: This is a bug. A-testsuite Area: The testsuite used to check the correctness of rustc labels Feb 15, 2019
@Centril
Copy link
Contributor

Centril commented Feb 15, 2019

This is probably due to compiling the test with Rust 2015; it works on Rust 2018. cc @scottmcm

@scottmcm
Copy link
Member

It definitely works in 2018: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=e2ca081a42124a7615dd542c3cc36324 See also the run-pass test for it: https://github.com/rust-lang/rust/blob/master/src/test/run-pass/try-block.rs

It was originally marked ignore because of needing 2018 (https://github.com/rust-lang/rust/blob/master/src/test/run-pass/try-block.rs), but was changed to run in 2018 when #54350 made that possible.

So I don't think there's a bug here.

@Centril
Copy link
Contributor

Centril commented Feb 18, 2019

@scottmcm The bug is in the unstable book linking the user towards a 2015 playground instead of a 2018 one.

@Centril Centril reopened this Feb 18, 2019
@scottmcm scottmcm added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. and removed A-testsuite Area: The testsuite used to check the correctness of rustc labels Feb 18, 2019
@scottmcm scottmcm changed the title unstable-book try_blocks build failed Playground links from code blocks in books need to obey edition2018 flag Feb 18, 2019
@scottmcm
Copy link
Member

@Centril Ok, renamed the issue and changed the flags. This isn't a testsuite problem, then.

@Centril
Copy link
Contributor

Centril commented Feb 18, 2019

@scottmcm good call :) cc @steveklabnik

@scottmcm
Copy link
Member

Related: rust-lang/mdBook#812

kennytm added a commit to kennytm/rust that referenced this issue Feb 18, 2019
Add a note about 2018e if someone uses `try {` in 2015e

Inspired by rust-lang#58491, where a `try_blocks` example was accidentally run in 2015, which of course produces a bunch of errors.

What's the philosophy about gating for this?  The keyword is stably a keyword in 2018, so I haven't gated it for now but am not mentioning what the keyword _does_.  Let me know if I should do differently.
@rconaway
Copy link

I need to use 2018 features in an MD book I'm creating.

It looks like this is a fresh issue, so I assume nobody has had a chance to deal with it yet. In the meantime, is there any work-around I can use?

I took a naive shot at changing a local copy of mdBook. In src/theme/book.js, I changed the url that (I think) runs the code to

https://play.rust-lang.org/evaluate.json?version=stable&mode=debug&edition=2018

That didn't seem to help any. Any other suggestions?

Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Feb 18, 2019
Add a note about 2018e if someone uses `try {` in 2015e

Inspired by rust-lang#58491, where a `try_blocks` example was accidentally run in 2015, which of course produces a bunch of errors.

What's the philosophy about gating for this?  The keyword is stably a keyword in 2018, so I haven't gated it for now but am not mentioning what the keyword _does_.  Let me know if I should do differently.
Centril added a commit to Centril/rust that referenced this issue Feb 20, 2019
Add a note about 2018e if someone uses `try {` in 2015e

Inspired by rust-lang#58491, where a `try_blocks` example was accidentally run in 2015, which of course produces a bunch of errors.

What's the philosophy about gating for this?  The keyword is stably a keyword in 2018, so I haven't gated it for now but am not mentioning what the keyword _does_.  Let me know if I should do differently.
Centril added a commit to Centril/rust that referenced this issue Feb 22, 2019
Add a note about 2018e if someone uses `try {` in 2015e

Inspired by rust-lang#58491, where a `try_blocks` example was accidentally run in 2015, which of course produces a bunch of errors.

What's the philosophy about gating for this?  The keyword is stably a keyword in 2018, so I haven't gated it for now but am not mentioning what the keyword _does_.  Let me know if I should do differently.

Resolves rust-lang#53672
Centril added a commit to Centril/rust that referenced this issue Feb 22, 2019
Add a note about 2018e if someone uses `try {` in 2015e

Inspired by rust-lang#58491, where a `try_blocks` example was accidentally run in 2015, which of course produces a bunch of errors.

What's the philosophy about gating for this?  The keyword is stably a keyword in 2018, so I haven't gated it for now but am not mentioning what the keyword _does_.  Let me know if I should do differently.

Resolves rust-lang#53672
@ehuss
Copy link
Contributor

ehuss commented Jul 18, 2019

This is fixed in beta (1.37) via rust-lang/mdBook#946.

@ehuss ehuss closed this as completed Jul 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants