Skip to content

Make an example more clear with sample code. #15121

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

Merged
merged 1 commit into from
Jun 25, 2014

Conversation

steveklabnik
Copy link
Member

Fixes #11113.

@steveklabnik
Copy link
Member Author

May want to elaborate a bit more, I'm not 100% sure.

@pnkfelix
Copy link
Member

After reading #11113, I will just comment that instead of the original sentence ("This excludes let from matching literals and most enum variants."), I would personally prefer a phrasing like "This excludes let from using literals and most enum variants as its binding patterns, since most such patterns are not irrefutable."

But I don't mind using an example in addition. :)

@pnkfelix
Copy link
Member

(Or even just "This excludes let from matching literals (and most enum variants) on the left-hand-side of the let." could work.)

@alexcrichton
Copy link
Member

I think you'll need an ignore directive to not run this as a test because it would otherwise fail.

@steveklabnik
Copy link
Member Author

@alexcrichton I thought so too, but I thought I compiled and it worked. Which seemed bad.

@alexcrichton
Copy link
Member

Just as an example:

$ rustdoc --test src/doc/tutorial.md

running 161 tests
... /* snip */

failures:

---- Control_structures_7 stdout ----
    <anon>:5:9: 5:15 error: refutable pattern in local binding: `(_, _)` not covered
    <anon>:5     let (a, 2) = (1, 2);
                     ^~~~~~
    error: aborting due to previous error
    task 'Control_structures_7' failed at 'Box<Any>', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/libsyntax/diagnostic.rs:127



failures:
    Control_structures_7

test result: FAILED. 133 passed; 1 failed; 27 ignored; 0 measured

task '<main>' failed at 'Some tests failed', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/libtest/lib.rs:243

@steveklabnik
Copy link
Member Author

Weird. @alexcrichton , does make not run the doc tests? what should I be running?

@alexcrichton
Copy link
Member

make check will run everything, but make check-stage2-doc is probably what you want to run for the guides/markdown files.

@steveklabnik
Copy link
Member Author

Okay, I've added the ignore, and also added the extra few words @pnkfelix suggested.

When I ran rustdoc --test, there were two unrelated failures. Let's see what Travis says.

@alexcrichton
Copy link
Member

r=me with a squash

@steveklabnik
Copy link
Member Author

Squashed.

@bors bors closed this Jun 25, 2014
@bors bors merged commit 53627dd into rust-lang:master Jun 25, 2014
@steveklabnik steveklabnik deleted the matching_docs branch October 25, 2017 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tutorial ambiguity or mistake re: destructuring & let
4 participants