Add capturing and precise capturing rules

The Reference didn't include any description of capturing or capturing
behavior for `impl Trait` opaque types.  Let's describe briefly what
capturing is and what the currently-stable automatic capturing rules
are.  Then let's describe the syntax and behavior of RFC 3617 precise
capturing.
3 files changed
tree: b8ae225c45b334d81f204f3a3010458096e6053a
  1. .github/
  2. docs/
  3. mdbook-spec/
  4. src/
  5. style-check/
  6. theme/
  7. .gitattributes
  8. .gitignore
  9. book.toml
  10. CONTRIBUTING.md
  11. LICENSE-APACHE
  12. LICENSE-MIT
  13. README.md
  14. reference.md
  15. rust-toolchain.toml
  16. STYLE.md
  17. triagebot.toml
README.md

The Rust Language Reference

This document is the primary reference for the Rust programming language.

This document is not normative. It may include details that are specific to rustc itself, and should not be taken as a specification for the Rust language. We intend to produce such a document someday, but this is what we have for now.

Dependencies

Installing dependencies

First, ensure that you have a recent copy of the nightly Rust compiler installed, as this is needed in order to run the tests:

rustup toolchain install nightly

Now, ensure you have mdbook installed, as this is needed in order to build the Reference:

cargo install --locked mdbook

Building

To build the Reference, first clone the project:

git clone https://github.com/rust-lang/reference.git

(Alternatively, if you don't want to use git, download a ZIP file of the project, extract it using your preferred tool, and rename the top-level directory to reference.)

Now change your current directory to the working directory:

cd reference

To test all of the code examples in the Reference, run:

mdbook test

For authors, consider using the server functionality which supports automatic reload.

To build the Reference locally (in build/) and open it in a web browser, run:

mdbook build --open

This will open a browser with a websocket live-link to automatically reload whenever the source is updated.

You can also open any current build of the reference by running:

mdbook serve --open