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

Rollup of 6 pull requests #39108

Merged
merged 12 commits into from Jan 17, 2017
Merged

Rollup of 6 pull requests #39108

merged 12 commits into from Jan 17, 2017

Conversation

And clarify that those arguments in assert!() are in fact formattable.
* Call functions "functions" instead of "methods".
* Link structures to their constructor functions
* Add other misc. documentation links
As it is written it creates a lot of confusion.
…ment-docs, r=GuillaumeGomez

Document the optional extra arguments to assert_eq!() / assert_ne!()

And clarify that those arguments in assert!() are in fact formattable.
Minor improvements to docs in std::env structures/functions.

* Call functions "functions" instead of "methods".
* Link structures to their constructor functions
* Add other misc. documentation links
…=GuillaumeGomez

Add doc examples & description in `std::os::unix::ffi`.

None
…eklabnik

An update to patterns documentation

As it is written the current pattern page creates a lot of confusion, even for someone with previous rust experience. It's so hard because it introduces an entirely new language feature without explaining. Someone could update it within the span of a few minutes by just explaining the newly introduced feature.

```rust
match c {
    x => println!("x: {} c: {}", x, c),
}
```
No where in the book up to this point has it explained that identifiers match patterns with just a name create an irrefutable pattern. The page uses this feature without explanation, it just assumes that readers would immediately understand it. To confuse the issue even further the topic uses this feature to explain shadowing, placing two x's from different scopes and different meanings without ever explaining why there is shadowing.

What follows comes across as utterly nonsensical given everything the reader would know about Rust about this point:

```rust
the result:
x: c c: c
x: x
```

x is c? What? Yes even if you understand that x here is not the x in the previous scope why would x equal 'c' here? What previous chapter explained this? The previous chapter on 'matching' only mentions the catch all '_' and never in any shape or form mentioned that a name here creates an irrefutable pattern and binds a value.

There are numerous examples of people not understanding this section, not finding answers and looking for them online about `x: c c: c`:

rust-lang/book#316

https://stackoverflow.com/questions/35563141/match-shadowing-example-in-the-patterns-section-of-the-rust-book-is-very-perplex

https://users.rust-lang.org/t/confusion-about-match-and-patterns/3937

https://www.bountysource.com/issues/38852461-question-on-patterns-section-shadowing-example-existing-book

And a [google search for `rust x: c c: c`](https://www.google.com/search?q=rust+%22x:+c+c:+c%22) finds many more people being tripped up, including people who speak a language other than English. I am confident that this page has resulted in questions on the irc channel more than once. Given rust already has a pretty big learning curve I recommend this be fixed.

I was asked to create PR from where I made this same case in the [rust book repository issue](rust-lang/book#316) (I didn't realize this was a separate project).
@rust-highfive
Copy link
Collaborator

r? @brson

(rust_highfive has picked a reviewer for you, use r? to override)

@GuillaumeGomez
Copy link
Member Author

@bors: r+ p=1

@bors
Copy link
Contributor

bors commented Jan 16, 2017

📌 Commit 04e74ce has been approved by GuillaumeGomez

@bors
Copy link
Contributor

bors commented Jan 16, 2017

⌛ Testing commit 04e74ce with merge c2b19c1...

bors added a commit that referenced this pull request Jan 16, 2017
Rollup of 6 pull requests

- Successful merges: #38247, #39028, #39065, #39084, #39105, #39106
- Failed merges:
@bors
Copy link
Contributor

bors commented Jan 17, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: GuillaumeGomez
Pushing c2b19c1 to master...

@bors bors merged commit 04e74ce into rust-lang:master Jan 17, 2017
@Centril Centril added the rollup A PR which is a rollup label Oct 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants