Skip to content

Wrapping code in fn main too much in the book's code examples #31249

Closed
@carols10cents

Description

@carols10cents

I've only found this to be a problem in the testing section but there could be more.

In the code example that follows "Let's make our test fail:", if you click the "Run" button to open that example in the playground, running it exits successfully when it's supposed to fail because the test gets wrapped in fn main:

screen shot 2016-01-27 at 6 53 20 pm

I'm not sure exactly where the fn main is being added, but if I inspect the HTML of the page there's a <span class="rusttest"> that contains fn main:

screen shot 2016-01-27 at 6 52 39 pm

Is there a way to opt out of the main wrapping in this case?

I know @steveklabnik is redoing the book; is integration with play.rust-lang.org going to be a part of the new book too, or is this irrelevant? Is this something that's just part of TRPL or is it part of rustbook that other books might use?

I'm going to go research the answers to these questions but wanted to post this in the meantime :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions