-
Notifications
You must be signed in to change notification settings - Fork 493
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
Remove enum variant expr #963
Conversation
657a0a3
to
cc8737c
Compare
Can you rebase so the diff is easier to read? |
cc8737c
to
d8cbe4e
Compare
It is quite redundant with the (IMO badly named) struct expression. Perhaps we should rename it to something else? "Named value expression"?
Rebased. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add this to book.toml
:
[output.html.redirect]
"/expressions/enum-variant-expr.html" = "struct-expr.html"
src/expressions/struct-expr.md
Outdated
A _struct expression_ creates a struct or union value. | ||
It consists of a path to a [struct] or [union] item followed by the values for the fields of the item. | ||
A *struct expression* creates a struct, enum, or union value. | ||
It consists of a path to a [struct], [enum], or [union] item followed by the values for the fields of the item. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems clearer, maybe?
It consists of a path to a [struct], [enum], or [union] item followed by the values for the fields of the item. | |
It consists of a path to a [struct], [enum variant], or [union] item followed by the values for the fields of the item. |
src/expressions/struct-expr.md
Outdated
@@ -101,7 +101,8 @@ Point3d { x, y: y_value, z }; | |||
## Tuple struct expression | |||
|
|||
A struct expression with fields enclosed in parentheses constructs a tuple struct. | |||
Though it is listed here as a specific expression for completeness, it is equivalent to a [call expression] to the tuple struct's constructor. For example: | |||
Though it is listed here as a specific expression for completeness, it is equivalent to a [call expression] to the tuple struct's constructor. For example: <!-- | |||
This is false. Example: Position(0, ..other_position) --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this comment. Can you show what it means?
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=a295289c9b9e281e95c80e220b3fd3ad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I figured that would work. Guess it does not, and its falseness is false.
Also, should there be a mention somewhere that the enum variant doesn't support functional record update syntax? Or did I miss that? |
1978748
to
d91074b
Compare
This is a minimal change, as I'd like to make more massive changes in a separate PR touching on most of the page.
Added the redirect, removed the comment, and changed to enum variant. Also added a thing about the syntax only working for struct type values. It's a bit wordy, and I'll do a cleanup pass on it later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Update books ## nomicon 1 commits in bbf06ad39d1f45654047e9596b750cc6e6d1b693..adca786547d08fe676b2fc7a6f08c2ed5280ca38 2021-01-22 07:07:31 -0800 to 2021-02-16 16:34:20 +0900 - Merge pull request rust-lang/nomicon#254 from mdaverde/ml/adds-compiler-err-lifetimes ## reference 9 commits in f02b09eb6e8af340ad1256a54adb7aae2ff3163e..361367c126290ac17cb4089f8d38fd8b2ac43f98 2021-01-22 01:53:02 -0800 to 2021-02-15 09:58:13 -0800 - Define turbofish in the glossary (rust-lang/reference#964) - Remove enum variant expr (rust-lang/reference#963) - One sentence is one line src/expressions/* (rust-lang/reference#962) - Referencify bool type (rust-lang/reference#940) - Fix typo in type cast expression table (rust-lang/reference#959) - Define rust (rust-lang/reference#953) - Remove "Memory Ownership" chapter (rust-lang/reference#952) - Added setting nightly as a requirement for running tests (rust-lang/reference#955) - Refactored build steps for better readability (rust-lang/reference#936) ## book 13 commits in e724bd826580ff95df48a8533af7dec1080693d4..db5e8a5105aa22979490dce30e33b68d8645761d 2021-01-20 08:19:49 -0600 to 2021-02-12 16:58:20 -0500 - Update to Rust 1.50 - Fix issue rust-lang/book#2574 - Improve the explanation about the behaviour of `read_line`. (rust-lang/book#2575) - closures: replace "is called" with "is defined" (rust-lang/book#2556) - Minor clarification: types -> values in ch16-04 (rust-lang/book#2587) - fixed hidden code listing (rust-lang/book#2610) - Merge remote-tracking branch 'origin/pr/2604' - (rust-lang/book#2601) - Merge remote-tracking branch 'origin/pr/2589' - Fix text wrapping - Some small rewordings I noticed while rereading just now - (rust-lang/book#2592) - Removed 'of' between type alias in Ch 19-04. (rust-lang/book#2581) - Merge remote-tracking branch 'origin/pr/2554' ## rust-by-example 2 commits in f633769acef68574427a6fae6c06f13bc2199573..551cc4bc8394feccea6acd21f86d9a4e1d2271a0 2021-01-13 20:58:25 -0300 to 2021-02-03 17:12:37 -0300 - remove // (rust-lang/rust-by-example#1409) - Update arc.md (rust-lang/rust-by-example#1406) ## edition-guide 3 commits in b91a9a881ee007c12e74e844460ec407cf07a50f..1da3c411f17adb1ba5de1683bb6acee83362b54a 2020-11-02 11:02:03 -0600 to 2021-02-16 16:46:40 -0800 - Update link for no_std. (rust-lang/edition-guide#231) - Add git link to the source. (rust-lang/edition-guide#228) - Update musl libc link (rust-lang/edition-guide#230) ## embedded-book 1 commits in ceec19e873be87c6ee5666b030c6bb612f889a96..4cf7981696a85c3e633076c6401611bd3f6346c4 2021-01-03 13:13:10 +0000 to 2021-02-11 10:55:22 +0000 - Fix installing dateutil since it is now a dependency of the GHP import script (rust-embedded/book#282)
This PR builds on top of #962, so that one needs to be approved and merged before this one.
This PR also gets rid the enum variant expression page. I think it was originally considered different when the expressions page was split into multiple chapters, and then quietly ignored. The struct expression page gives the same amount of information, plus more. It could give more (e.g. mentioning that it sets the discriminant), but I'll do that when I clean up the struct expression page itself.