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

Fix expr links #65

Merged
merged 2 commits into from
Jun 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions src/expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ the following lvalues may be moved out of:
* [Variables](variables.html) which are not currently borrowed.
* [Temporary values](#temporary-lifetimes).
* [Fields](#field-expressions) of an lvalue which can be moved out of and
doesn't implement [`Drop`](#the-drop-trait).
doesn't implement [`Drop`](the-drop-trait.html).
* The result of [dereferencing](#the-dereference-operator) an expression with
type `Box<T>` and that can also be moved out of.

Expand Down Expand Up @@ -123,8 +123,8 @@ Here are some examples:

Certain expressions will treat an expression as an lvalue by implicitly
borrowing it. For example, it is possible to compare two unsized
[slices](#array-and-slice-types) for equality directly, because the `==`
operator implicitly borrows it's operands:
[slices](types.html#array-and-slice-types) for equality directly, because the
`==` operator implicitly borrows it's operands:

```rust
# let c = [1, 2, 3];
Expand Down Expand Up @@ -155,17 +155,17 @@ Certain types of expressions can be evaluated at compile time. These are called
_constant expressions_. Certain places, such as in
[constants](items.html#constant-items) and [statics](items.html#static-items),
require a constant expression, and are always evaluated at compile time. In
other places, such as in [`let` statements](let-statements), constant
expressions may be evaluated at compile time. If errors, such as out of bounds
[array access](#index-expressions) or [overflow](#overflow) occurs, then it is
a compiler error if the value must be evaluated at compile time, otherwise it
is just a warning, but the code will most likely panic when run.
other places, such as in [`let` statements](statements.html#let-statements),
constant expressions may be evaluated at compile time. If errors, such as out
of bounds [array access](#index-expressions) or [overflow](#overflow) occurs,
then it is a compiler error if the value must be evaluated at compile time,
otherwise it is just a warning, but the code will most likely panic when run.

The following expressions are constant expressions, so long as any operands are
also constant expressions:

* [Literals](#literal-expressions).
* [Paths](#paths) to [functions](items.html#functions) and constants.
* [Paths](#path-expressions) to [functions](items.html#functions) and constants.
Recursively defining constants is not allowed.
* Paths to statics, so long as only their address, not their value, is used.
This includes using their value indirectly through a compilicated expression.
Expand All @@ -190,7 +190,7 @@ also constant expressions:
boolean](#lazy-boolean-operators) operators used on integer and floating
point types, `bool` and `char`.
* Shared [borrow expressions](#borrow-operators).
* The [dereference operator](#dereference-operator), but not to circumvent the
* The [dereference operator](#the-dereference-operator), but not to circumvent the
rule on statics.
* [Grouped expressions](#grouped-expressions).
* [Cast expressions](#type-cast-expressions), except pointer to address and
Expand Down Expand Up @@ -223,7 +223,7 @@ A [path](paths.html) used as an expression context denotes either a local
variable or an item. Path expressions that resolve to local or static variables
are [lvalues](expressions.html#lvalues-and-rvalues), other paths
are rvalues. Using a `static mut` variable requires an [`unsafe`
block](#unsafe-block).
block](#unsafe-blocks).

```rust
# mod globals {
Expand Down Expand Up @@ -452,17 +452,17 @@ mystruct.method(); // Method expression
(mystruct.function_field)() // Call expression containing a field expression
```

A field access is an [lvalue](expressions.html#lvalues-and-rvalues)
referring to the value of that field. When the subexpression is
[mutable](#mutability), the field expression is also mutable.
A field access is an [lvalue](lvalues-and-rvalues) referring to the value of
that field. When the subexpression is [mutable](#mutability), the field
expression is also mutable.

Also, if the type of the expression to the left of the dot is a pointer, it is
automatically dereferenced as many times as necessary to make the field access
possible. In cases of ambiguity, we prefer fewer autoderefs to more.

Finally the fields of a struct, a reference to a struct are treated as separate
entities when borrowing. If the struct does not implement
[`Drop`](#the-drop-trait) this also applies to moving out of each of its fields
[`Drop`](the-drop-trait.html) this also applies to moving out of each of its fields
where possible. This also does not apply if automatic dereferencing is done
though user defined types.

Expand Down
6 changes: 3 additions & 3 deletions src/tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,8 @@ otherwise appear as [unary operators], [binary
operators], or [keywords].
They are catalogued in [the Symbols section][symbols] of the Grammar document.

[unary operators]: expressions.html#unary-operator-expressions
[binary operators]: expressions.html#binary-operator-expressions
[unary operators]: expressions.html#borrow-operators
[binary operators]: expressions.html#arithmetic-and-logical-binary-operators
[tokens]: #tokens
[symbols]: ../grammar.html#symbols
[keywords]: ../grammar.html#keywords
[keywords]: ../grammar.html#keywords
2 changes: 1 addition & 1 deletion src/variables.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Variables

A _variable_ is a component of a stack frame, either a named function parameter,
an anonymous [temporary](expressions.html#lvalues-and-rvalues), or a named local
an anonymous [temporary](expressions.html#temporary-lifetimes), or a named local
variable.

A _local variable_ (or *stack-local* allocation) holds a value directly,
Expand Down