Skip to content

Commit

Permalink
rust.md: Explicitly point out how special 'static is.
Browse files Browse the repository at this point in the history
Drive-by: fix description of `&content` to point out that `&'f type`
is (as of today) only for type expressions.
  • Loading branch information
pnkfelix committed Aug 9, 2014
1 parent 0ba2d04 commit 97e82cc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/doc/rust.md
Expand Up @@ -1356,6 +1356,9 @@ A *static item* is a named _constant value_ stored in the global data section of
Immutable static items are stored in the read-only data section.
The constant value bound to a static item is, like all constant values, evaluated at compile time.
Static items have the `static` lifetime, which outlives all other lifetimes in a Rust program.
Only values stored in the global data section (such as string constants
and static items) can have the `static` lifetime;
dynamically constructed values cannot safely be assigned the `static` lifetime.
Static items are declared with the `static` keyword.
A static item must have a _constant expression_ giving its definition.

Expand Down Expand Up @@ -3621,7 +3624,10 @@ There are four varieties of pointer in Rust:
References arise by (automatic) conversion from owning pointers, managed pointers,
or by applying the borrowing operator `&` to some other value,
including [lvalues, rvalues or temporaries](#lvalues,-rvalues-and-temporaries).
References are written `&content`, or in some cases `&'f content` for some lifetime-variable `f`,
A borrow expression is written `&content`.

A reference type is written `&'f type` for some lifetime-variable `f`,
or just `&type` when the lifetime can be elided;
for example `&int` means a reference to an integer.
Copying a reference is a "shallow" operation:
it involves only copying the pointer itself.
Expand Down

13 comments on commit 97e82cc

@bors
Copy link
Contributor

@bors bors commented on 97e82cc Aug 10, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at pnkfelix@97e82cc

@bors
Copy link
Contributor

@bors bors commented on 97e82cc Aug 10, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging pnkfelix/rust/fsk-rust.md-fixes = 97e82cc into auto

@bors
Copy link
Contributor

@bors bors commented on 97e82cc Aug 10, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pnkfelix/rust/fsk-rust.md-fixes = 97e82cc merged ok, testing candidate = fbd40ac8

@bors
Copy link
Contributor

@bors bors commented on 97e82cc Aug 10, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 97e82cc Aug 11, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at pnkfelix@97e82cc

@bors
Copy link
Contributor

@bors bors commented on 97e82cc Aug 11, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging pnkfelix/rust/fsk-rust.md-fixes = 97e82cc into auto

@bors
Copy link
Contributor

@bors bors commented on 97e82cc Aug 11, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pnkfelix/rust/fsk-rust.md-fixes = 97e82cc merged ok, testing candidate = e146265f

@bors
Copy link
Contributor

@bors bors commented on 97e82cc Aug 11, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 97e82cc Aug 13, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at pnkfelix@97e82cc

@bors
Copy link
Contributor

@bors bors commented on 97e82cc Aug 13, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging pnkfelix/rust/fsk-rust.md-fixes = 97e82cc into auto

@bors
Copy link
Contributor

@bors bors commented on 97e82cc Aug 13, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pnkfelix/rust/fsk-rust.md-fixes = 97e82cc merged ok, testing candidate = d917770

@bors
Copy link
Contributor

@bors bors commented on 97e82cc Aug 13, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = d917770

Please sign in to comment.