Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
4931cf6
Start a contributor guide
ehuss Nov 22, 2025
b141dcb
Move the building section to the contributor guide
ehuss Nov 22, 2025
a1cd48e
Apply some light edits to "Building the Reference"
ehuss Nov 22, 2025
8d48283
Move the publishing process to the contributor guide
ehuss Nov 22, 2025
6b6d429
Move the contributing guide to the introduction
ehuss Nov 22, 2025
47c771d
Add a forward to the new contributing guide
ehuss Nov 22, 2025
548fcd6
Unwrap the introduction
ehuss Nov 22, 2025
baef319
Apply some light edits to the introduction
ehuss Nov 22, 2025
c9d3c1f
Move the review policy to the contributor guide
ehuss Nov 22, 2025
997c1a2
Apply some light edits to the review policy
ehuss Nov 22, 2025
44b557f
Move the grammar guide to the contributor guide
ehuss Nov 22, 2025
e201fd6
Apply some light edits to the rust grammar chapter
ehuss Nov 22, 2025
7f451cc
Move the attribute template to the contributor guide
ehuss Nov 22, 2025
561ccfd
Update attributes chapter title
ehuss Nov 22, 2025
4b8797a
Add a chapter describing mdbook-spec
ehuss Nov 23, 2025
09fa9d6
Start a formatting chapter
ehuss Nov 23, 2025
a5ca52f
Move markdown formatting to the contributor guide
ehuss Nov 23, 2025
01b3202
Move admonitions to the contributor guide
ehuss Nov 23, 2025
e54440a
Move examples to the contributor guide
ehuss Nov 23, 2025
7bf73a4
Move standard library links to the links chapter
ehuss Nov 23, 2025
d03126d
Add more details to the links chapter
ehuss Nov 23, 2025
c1e660f
Move rules to the contributor guide
ehuss Nov 23, 2025
c75fcb9
Add a contributor tests chapter
ehuss Nov 23, 2025
34ddfe6
Start a style guide
ehuss Nov 23, 2025
cf6be1a
Start the wording style chapter
ehuss Nov 23, 2025
2d4a6f2
Start the punctuation chapter
ehuss Nov 23, 2025
856aa21
Add an introduction to the tooling sub-chapters
ehuss Nov 23, 2025
994b06b
Add a resources chapter
ehuss Nov 23, 2025
8e71ec8
Link README to the new contributor guide
ehuss Nov 23, 2025
f4cea7a
Remove STYLE.md
ehuss Nov 23, 2025
bb75924
Add a contribution process chapter
ehuss Nov 24, 2025
5f173b3
Apply some light edits to the rules chapter
ehuss Nov 25, 2025
b137d6a
Apply some light edits to the publishing process
ehuss Nov 25, 2025
0e23db7
Apply light edits to standard library links
ehuss Nov 25, 2025
0120932
Apply some light edits to the introduction
ehuss Nov 25, 2025
8bfc8b9
Apply some light edits to the grammar chapter
ehuss Nov 25, 2025
b321e4f
Apply some light edits to the markdown chapter
ehuss Nov 25, 2025
19cef87
Apply some light edits to the examples chapter
ehuss Nov 25, 2025
a7a2033
Apply light edits to the attributes chapter
ehuss Nov 25, 2025
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
18 changes: 18 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,23 @@ jobs:
working-directory: ./xtask
run: cargo fmt --check

reference-dev-guide:
name: reference-dev-guide build check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Install mdbook
env:
MDBOOK_VERSION: 0.5.1
run: |
mkdir bin
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
echo "$(pwd)/bin" >> $GITHUB_PATH
- name: Check reference-dev-guide build
run: |
cd reference-dev-guide
mdbook build

preview:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
Expand Down Expand Up @@ -153,6 +170,7 @@ jobs:
- code-tests
- style-tests
- mdbook-spec
- reference-dev-guide
# preview is explicitly excluded here since it doesn't run on merge
runs-on: ubuntu-latest
steps:
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/reference-dev-guide.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Deploy reference-dev-guide
on:
push:
branches:
- master

env:
MDBOOK_VERSION: 0.5.1

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- name: Install mdbook
run: |
mkdir mdbook
curl -Lf https://github.com/rust-lang/mdBook/releases/download/v${{ env.MDBOOK_VERSION }}/mdbook-v${{ env.MDBOOK_VERSION }}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
echo `pwd`/mdbook >> $GITHUB_PATH

- name: Build the book
run: |
cd reference-dev-guide
mdbook build
mkdir out
touch out/.nojekyll
mv book out/reference-dev-guide

- name: Upload Artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./reference-dev-guide/out

deploy:
needs: build

permissions:
pages: write
id-token: write

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
steps:
- id: deployment
uses: actions/deploy-pages@v4
77 changes: 2 additions & 75 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,3 @@
Thank you for your interest in contributing to the Rust Reference!
# Contributing to The Rust Reference

There are a few ways of helping with the reference: critiquing the reference,
editing the reference, fixing incorrect information, adding examples and
glossary entries, and documenting new or otherwise undocumented features in
Rust.

For a while, the Reference was basically ignored, and Rust continued gaining new
features or changing old ones. It was also basically the introduction document
before the first edition of the Rust book, and constantly in flux from the huge
churn of the language design before v1.0.0. So there's a lot that's wrong, too
teachy for people who should have basic understanding of Rust, or is too shallow
for the Reference. As such, we have the warning saying there's work that needs
to be done. Eventually, we plan to make sure everything is well documented
enough that we can remove the warning.

It is encouraged for you to read the [introduction] to familiarize yourself with
the kind of content the reference is expected to contain and the conventions it
uses. Also, the [Authoring Guide] provides more detailed guidelines for
formatting and content.

## Critiquing the Reference

This is the easiest way to contribute. Basically, as you read the reference, if
you find something confusing, incorrect, or missing, then you can file an issue
against the reference explaining your concerns.

## Editing the Reference

Typos and incorrect links get through from time to time. Should you find them,
we welcome PRs to fix them. Additionally, larger editing jobs that help remove
the number of parentheticals, remove comma splices, italicize term definitions
and other similar tasks are helpful.

## Adding examples and glossary entries

Examples are great. Many people will only read examples and ignore the prose.
Ideally, every facet of every feature will have an example.

Likewise, the reference has a glossary. It doesn't need to explain every facet
of every feature nor contain every definition, but it does need to be expanded
upon. Ideally entries in the glossary link to the associated documentation.

## Adding documentation

There are a lot of features that are not documented at all or are documented
poorly. This is the hardest, but definitely most valuable. Pick an unassigned
issue from the [issue tracker], and write about it.

While writing, you may find it handy to have a [playpen] open to test out what
you are documenting.

Feel free to take information from the standard library and Rustonomicon as
appropriate.

Note that we don't write documentation for purely library features such as
threads and IO and we don't write about Rust in the future. Documentation is
written as if the current stable release of Rust is the last release. The
`master` branch of the reference corresponds to what is **stable** on the
`master` branch ("nightly") of [rust-lang/rust]. If you want to write about
Rust in the future, you want [the Unstable book][unstable].

## Stabilization

When something that alters the language is stabilized, an issue should be
opened on the reference [issue tracker] to track the documentation process.
This should include links to any relevant information, such as the
stabilization PR, the RFC, the tracking issue, and anything else that would be
helpful for writing the documentation.

[Authoring Guide]: docs/authoring.md
[introduction]: src/introduction.md
[issue tracker]: https://github.com/rust-lang/reference/issues
[playpen]: https://play.rust-lang.org/
[rust-lang/rust]: https://github.com/rust-lang/rust/
[unstable]: https://doc.rust-lang.org/nightly/unstable-book/
See the [Reference Developer Guide](https://rust-lang.github.io/reference/reference-dev-guide/) for information on contributing to the Reference.
89 changes: 1 addition & 88 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,91 +4,4 @@ This document is the primary reference for the Rust programming language.

## Contributor docs

There are several pages for those working on the reference:

* [Authoring guide](https://github.com/rust-lang/reference/blob/master/docs/authoring.md): Guidelines for writing content.
* [Review policy](https://github.com/rust-lang/reference/blob/master/docs/review-policy.md): Guidelines for reviewers.
* [Grammar](https://github.com/rust-lang/reference/blob/master/docs/grammar.md): How the grammar syntax works.
* [Attribute template](https://github.com/rust-lang/reference/blob/master/docs/attribute-template.md): The standard template for documenting an attribute.

## Building

To build the Reference, first clone the project:

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

(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`.)

[download]: https://github.com/rust-lang/reference/archive/refs/heads/master.zip

### Installing mdbook

The Reference is built using [mdbook].

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

```sh
rustup toolchain install nightly
rustup override set nightly
```

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

```sh
cargo install --locked mdbook
```

[mdbook]: https://rust-lang.github.io/mdBook/

### Running mdbook

`mdbook` provides a variety of different commands and options to help you work on the book:

* `mdbook build --open`: Build the book and open it in a web browser.
* `mdbook serve --open`: Launches a web server on localhost. It also automatically rebuilds the book whenever any file changes and automatically reloads your web browser.

The book contents are driven by a `SUMMARY.md` file, and every file must be linked there. See <https://rust-lang.github.io/mdBook/> for its usage.

### `SPEC_RELATIVE`

The `SPEC_RELATIVE=0` environment variable makes links to the standard library go to <https://doc.rust-lang.org/> instead of being relative, which is useful when viewing locally since you normally don't have a copy of the standard library.

```sh
SPEC_RELATIVE=0 mdbook serve --open
```

The published site at <https://doc.rust-lang.org/reference/> (or local docs using `rustup doc`) does not set this, which means it will use relative links which supports offline viewing and links to the correct version (for example, links in <https://doc.rust-lang.org/1.81.0/reference/> will stay within the 1.81.0 directory).

### `SPEC_DENY_WARNINGS`

The `SPEC_DENY_WARNINGS=1` environment variable will turn all warnings generated by `mdbook-spec` to errors. This is used in CI to ensure that there aren't any problems with the book content.

### `SPEC_RUST_ROOT`

The `SPEC_RUST_ROOT` can be used to point to the directory of a checkout of <https://github.com/rust-lang/rust>. This is used by the test-linking feature so that it can find tests linked to reference rules. If this is not set, then the tests won't be linked.

## Running tests

There are several different kinds of tests you can run (these are enforced on CI):

* `mdbook test`: This will run the inline Rust codeblocks (internally it uses `rustdoc` to do this).
* `cargo xtask style-check`: This will validate some style checks (see [authoring guide](docs/authoring.md)).
* `cargo xtask linkcheck`: This will validate that markdown links aren't broken.
* `cargo xtask test-all`: Runs all tests.

## How is this published?

The process for getting the reference content into a [Rust release](https://doc.rust-lang.org/reference/#rust-releases) and on the website is:

1. Changes are merged to this repository.
2. [Triagebot](https://forge.rust-lang.org/triagebot/doc-updates.html) will automatically synchronize this repository to [rust-lang/rust]. This happens every other week. The reference is tracked in [rust-lang/rust] as a [submodule](https://github.com/rust-lang/rust/tree/master/src/doc).
- This will open a PR on [rust-lang/rust] which needs to be merged, and that can take up to several days.
3. At midnight UTC, whatever is on the default branch of [rust-lang/rust] will be a part of that nightly release, and will be published after a few hours to <https://doc.rust-lang.org/nightly/reference/>.
4. Following Rust's [release process](https://doc.rust-lang.org/book/appendix-07-nightly-rust.html), every 6 weeks, nightly will be promoted to beta (<https://doc.rust-lang.org/beta/reference/>), and then 6 weeks after that it will be promoted to stable (<https://doc.rust-lang.org/stable/reference/>).

[rust-lang/rust]: https://github.com/rust-lang/rust/
See the [Reference Developer Guide](https://rust-lang.github.io/reference/reference-dev-guide/) for information on contributing to the Reference.
5 changes: 0 additions & 5 deletions STYLE.md

This file was deleted.

Loading