Commit Graph

133 Commits

Author SHA1 Message Date
Gary Guo 01c8196e01 Add const blocks 2024-04-29 12:09:17 +01:00
macaujack 1da2af1481
Typo: 'assingee' to 'assignee' in expressions.md 2023-07-02 23:01:39 +08:00
Ryan Scheel (isHavvy) 45c47cd386 One line one sentence the statements and expressions chapter. 2022-10-04 20:08:52 -07:00
Ryan Scheel (isHavvy) e076c6ed0c One line one sentence for the Statements chapter. 2022-10-04 20:08:49 -07:00
Ryan Scheel (isHavvy) cadf497c73 One line one sentence for main Expressions chapter. 2022-10-04 20:07:15 -07:00
León Orell Valerian Liehr d32ca057e7
Classify AsyncBlockExpression as ExpressionWithoutBlock 2022-09-11 17:11:16 +02:00
Michael Goulet 4aff5bed5e Revert "Unify while/while let and if/if let expressions."
This reverts commit b83d8e616c.
2022-08-14 21:00:49 +00:00
Eric Huss b83d8e616c Unify while/while let and if/if let expressions.
This updates the `if` and `while` expressions so that they each are
presented as a single expression kind with multiple condition operators
instead of being logically separated from their `let` counterparts.

This also includes various fixes and additions.
2022-07-25 15:42:28 -07:00
Ralf Jung 3501d8599f edits 2022-07-17 13:17:15 -07:00
varkor 5775428597 Document destructuring assignment 2022-01-17 13:04:16 +01:00
DaErich daa0b4858e expressions.md: Attempt fixing broken grammar in Mutability paragraph 2021-08-28 20:08:45 +02:00
kklibo 83f725f1b9 minor grammar and typo fixes 2021-07-26 13:09:05 -07:00
Taylor Yu 97ba67cbee fix grammar in Expressions
Fix minor grammar errors in Expressions, mostly adjusting
punctuation, but also fixing missing or incorrect words.
2021-07-04 20:13:04 -05:00
Havvy (Ryan Scheel) 31dc83fe18 More editorial changes to expressions
* Go back to calling the syntactic elements "expressions", but name
  them operands afterwards.
* Use "called XYZ" to name something in syntax.
* Trade out a few uses of expressions using letters for operand names
  for the actual operand names.
* Pick arbitrary names for the operands. I don't like some of them, but
  they're not set in stone.
* Say they're not set in stone in the main expressions chapter.
2021-03-03 21:39:17 -08:00
Havvy (Ryan Scheel) a065d3e4c2 Editorial cleanup on expressions (part 1)
* Use "the syntax of" uniformly.
* Use asterisks for all defined terms.
* Define more terms, espcially in the syntax section.
** Reword things so that definitions are generally first.
** I did not necessarily go with the best wording; the idea is to
   improve, not perfect. I still need to dedicate time to each
   expressions individually.
* Remove usage of "the compiler" and "Rust".
** This also involved rewording.
** How to deal with closure types and closure expressions is gonna be
   an interesting question to solve. I avoided solving it here.
* Remove non-normative information or put them in a `Note`.
* A few added section headers
* Move links to the bottom

Note that I've left quite a few nonsensical statements alone, such as
any that use "denote". They'll be treated separately.

About halfway through the list of expressions and this PR is getting
large. So I'm gonna cut this one here, stopping at grouped expressions
in the alphabetical list.
2021-02-27 13:51:16 -08:00
Havvy (Ryan Scheel) d8cbe4eedb Remove enum variant expression page
It is quite redundant with the (IMO badly named) struct expression.
Perhaps we should rename it to something else? "Named value expression"?
2021-02-14 11:54:46 -08:00
Havvy (Ryan Scheel) 9360ab990a Assignment expressions are *NOT* LTR evaluated.
This commit does not try to define their evaluation order, they just
removed them from the list of shared LTR evaluated expressions.
2021-01-13 22:09:05 -08:00
Havvy (Ryan Scheel) 8458c781b0 Explicitly list which exprs for shared eval order PR 2021-01-13 22:09:04 -08:00
Havvy (Ryan Scheel) 02315d3b63 Change sub-expression to operand in a few places 2021-01-13 22:09:04 -08:00
Havvy (Ryan Scheel) 9379f415df More precise terminology on evaluation order
I've italicized "operand" showing that it is a definition. I didn't
actually remember that being added to the reference, so I basically
tried to redefine it in the previous commit. I don't like the term, but
since it's already there, I'll just use it.

I also put in a note saying that operator precedence determines the
operands of an expression. That section could probably be written in a
style that better expresses that perspective, but I'm trying to keep
this change minimal.

I also stated that the evaluation of operands is done prior to applying
the effect. This goes in line with the beginning of the chapter with
what the meaning of an expression.

Note also that this only describes the default. Expressions that deviate
from the default already should describe their evaluation order.
2021-01-13 22:09:04 -08:00
Havvy (Ryan Scheel) ff28b35448 Document evaluation order 2021-01-13 22:09:04 -08:00
Jan Parthey 8c45228514 Fix name of trait for array indexing. 2020-06-28 21:18:18 +02:00
Matthew Jasper 79fcc6e445 Fix links and sentence structure 2020-04-09 20:53:27 -07:00
Matthew Jasper 62191f6b4e Document drop scopes 2020-04-09 20:52:23 -07:00
Eric Huss 36b557cb40 No need to mention if/if-let expressions.
The first point ("Before an expression") covers those.
2020-04-09 20:33:34 -07:00
Aaron Hill 361c09ebef
Attributes are now allowed on `if` and `if let`
This became possible with https://github.com/rust-lang/rust/pull/69201
2020-03-13 16:44:31 -04:00
Will Hawkins af1cf6d3ca Fix #664: Review Oxford comma usage.
This is an update to correct for the places where the Oxford
comma is not used.
2019-09-03 03:16:49 -04:00
Niko Matsakis e0b5db6c9c async-await reference material (squashed) 2019-08-27 16:15:27 -04:00
Eric Huss b0e0ad6490 Update to mdbook 0.3.
This updates to mdbook 0.3 which uses relative links, which are much better
(the pages mostly work when viewing on GitHub for example).
2019-07-15 16:51:25 -07:00
Eric Huss 2fca10d390 Remove unused link references.
Verified the output is the same except for the one link in `macros.md` that
I corrected.
2019-04-09 14:26:37 -07:00
Matthew Jasper 3d8304d87b grammar fixes 2019-01-27 15:25:09 +00:00
Matthew Jasper 37b648ac1a Address review comments 2019-01-27 15:13:37 +00:00
Matthew Jasper 6e1eef6576 Clarify what access struct updates do 2019-01-27 13:12:31 +00:00
Eric Huss 0a15f29adb Split Types Chapter
This splits the types chapter into multiple subchapters.

I tried to avoid content changes, but I ended up with a few changes:
- Added overview links in `types.md`, and a separate discussion of type expressions.
- Split array and slice into separate chapters. Although there is some overlap between them, I feel like it was awkward explaining one and then the other. I also felt it conflated the two too much since slices can be used for more than arrays.
- Combined `Self` section with the one on the paths page.
- Added a basic redirector for external links.

Some pages may seem a little bare now, but I think each type page has potential to be expanded and improved in the future.
2018-11-04 18:01:30 -08:00
Eric Huss 0c12690eed Grammar: macros 2018-11-03 11:12:19 -07:00
Eric Huss 49f5c9a700 Fix statements and add some missing attributes. 2018-10-19 15:01:20 -07:00
Eric Huss e4c177072c Update statements and expressions with outer attributes. 2018-10-18 11:09:02 -07:00
Eric Huss f6f65fee86 Grammar: Statements.
Cleans up "Statement" definition.
Adds "let" statement.
2018-10-18 11:09:02 -07:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer 3e3be42505
Move const expressions to const_eval 2018-10-08 14:14:09 +02:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer eee560ccec
Update expressions.md 2018-10-08 11:32:26 +02:00
Havvy (Ryan Scheel) cc18f2b3cc the originally -> originally 2018-09-15 12:13:06 -07:00
Eric Huss 6798bfea83 Fix some broken links. 2018-08-02 14:04:38 -07:00
Eric Huss 855df8ac6a Use backslash instead of whitespace for hard breaks.
The only formatting change is to add breaks on the weak keywords in
`keywords.md`.
2018-06-24 14:43:38 -07:00
Matthew Jasper 376e2cb16d Fixes for operator precedence
Clarify associativity
Remove unstable operators
2018-03-28 14:33:10 +01:00
Alexis Hunt 547305f967 Document inclusive ranges. 2018-03-15 19:02:44 -04:00
Ryan Scheel b4c41c7844
Merge pull request #264 from brauliobz/grammar_expr_toplevel
Grammar for expressions
2018-03-11 11:05:10 -07:00
Bráulio Bezerra 049bbff3fa Reordered the expression prodctions to match the table of contents order 2018-03-11 11:34:31 -03:00
Bráulio Bezerra e185e429e9 Grammar for expressions 2018-03-10 11:40:38 -03:00
Bráulio Bezerra 9ae7b6f20a Adjustments after review 2018-03-10 11:09:36 -03:00
Bráulio Bezerra fc955475f8 Moved grouped expressions to its own page. Added another example of its use. 2018-03-10 07:56:57 -03:00