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

Add "scopes" chapter. #1040

Merged
merged 472 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
472 commits
Select commit Hold shift + click to select a range
76f771b
Merge pull request #1342 from est31/labeled_blocks
ehuss Mar 20, 2023
3c47807
Merge pull request #1323 from Amanieu/asm-order
ehuss Mar 26, 2023
0a89373
Explain typos in `asm!` can be unsound
workingjubilee Mar 27, 2023
6e6e8b4
redundant word removed
voidpx Mar 29, 2023
fcc12c7
Merge pull request #1346 from sam-zheng/patch-1
ehuss Mar 29, 2023
f0bb14c
Remove note about raw-dylib being unstable on x86 Windows
dpaoliello Mar 27, 2023
fc61be0
Fix coding style: add space between module name and bracket
n-eq Apr 6, 2023
5c328ef
Merge pull request #1347 from n-eq/patch-1
ehuss Apr 6, 2023
aba56b9
Move Correctness and Validity section
workingjubilee Apr 8, 2023
1f8dc72
Merge pull request #1344 from workingjubilee/patch-1
ehuss Apr 9, 2023
2749bce
first pass for debugger_visualizer docs
gibbyfree Feb 27, 2023
ed69dfa
move to debugger page, modify style
gibbyfree Feb 28, 2023
e6f6ce8
add line
gibbyfree Feb 28, 2023
8db722e
add details for GDB auto-load
gibbyfree Mar 2, 2023
2d45187
fix style errors
gibbyfree Mar 2, 2023
5784e53
fix broken link
gibbyfree Mar 2, 2023
c3be903
fix rustdoc failures
gibbyfree Mar 2, 2023
1c56d59
address pr comments
gibbyfree Mar 6, 2023
4dee364
fix compile errors in code snippets
gibbyfree Mar 7, 2023
ae66749
Merge pull request #1334 from ehuss/inline-assembly-x86_64
ehuss May 5, 2023
689ef05
Merge pull request #1337 from ehuss/f16c
ehuss May 5, 2023
089f6e1
keywords.md: add an entry for macro_rules in the "Weak keywords" lexe…
mattheww May 6, 2023
39a0be6
Updates and copy-edits for debugger_visualizer.
ehuss May 6, 2023
28dc0f3
Merge pull request #1356 from mattheww/2023-05_kw_macro_rules
ehuss May 6, 2023
b36de24
Add LoongArch to inline-assembly documentation
heiher May 8, 2023
0e4662d
removed a space that causes annotation of the output of some code to …
Oxyn4 May 10, 2023
9ac3de6
Merge pull request #1358 from Oxyn4/master
ehuss May 10, 2023
042cd78
fix a typo
OccupyMars2025 May 11, 2023
5ddf52a
Merge pull request #1359 from OccupyMars2025/patch-1
ehuss May 11, 2023
47b54b5
Merge pull request #1345 from dpaoliello/rawdylib
ehuss May 14, 2023
5f49f2d
fix example code in impl docs
eegli May 17, 2023
f30520a
Merge pull request #1335 from gibbyfree/natvis-doc
ehuss May 22, 2023
3f5f3b2
Remove use of `ignore` from examples.
ehuss May 22, 2023
553d99b
Merge pull request #1360 from eegli/patch-1
ehuss May 22, 2023
b1d0c5b
comments: Fix typo: inner -> outer
spencerwilson May 25, 2023
e5ecb2d
Merge pull request #1364 from spencerwilson/patch-1
ehuss May 25, 2023
236e014
Update src/attributes/codegen.md
Lokathor May 28, 2023
a38bdf7
Update src/attributes/codegen.md
Lokathor May 28, 2023
5787c88
Merge pull request #1357 from loongarch-rs/loongarch
ehuss May 29, 2023
9b49697
Fix inconsistent formatting of Disambiguating Function Calls example
foresterre Jun 8, 2023
862d6f4
Merge pull request #1366 from foresterre/fix
ehuss Jun 9, 2023
9eaa65a
Remove note about soundness hole in type-layout.md
yjhn Jun 14, 2023
cbbff21
Apply review suggestion
yjhn Jun 15, 2023
2dc423d
remove space at the end of line
yjhn Jun 15, 2023
3319e0e
Document the ordering behavior of crate cfgs
riking Jun 20, 2023
2e85a35
fix incorrect syntax for type-paths
Equilibris Jun 21, 2023
da57c4a
Merge pull request #1370 from Equilibris/fix-incorrect-type-path-syntax
ehuss Jun 22, 2023
5ca365e
Merge pull request #1369 from riking/patch
ehuss Jun 22, 2023
193aa55
Typo: 'a' to 'an' in destructors.md
macaujack Jun 26, 2023
353e038
Merge pull request #1371 from macaujack/patch-1
ehuss Jun 26, 2023
3b6313a
Merge pull request #1367 from yjhn/patch-1
ehuss Jun 27, 2023
188499d
Update codegen.md
Lokathor Jun 27, 2023
0e2eee4
str type: make sentence more readable
tshepang Jun 28, 2023
15c26a1
Merge pull request #1374 from tshepang/patch-2
ehuss Jun 29, 2023
6eacdb0
Remove doc of unstable feature of never type
hehaoqian Jul 1, 2023
1da2af1
Typo: 'assingee' to 'assignee' in expressions.md
macaujack Jul 2, 2023
1c231ad
Merge pull request #1377 from macaujack/patch-2
ehuss Jul 2, 2023
1ea0178
Merge pull request #1376 from hehaoqian/remove-unstable-of-never
ehuss Jul 8, 2023
3c3c084
Clarify which proof obligations are referenced.
gregschmit Jul 9, 2023
dad0240
Add CI trigger for merge queues.
ehuss Jul 16, 2023
5b7b383
Merge pull request #1381 from ehuss/merge_group
ehuss Jul 16, 2023
cf1cc8d
Say that division by zero for primitive types panics
mattheww Jul 17, 2023
6235897
Merge pull request #1382 from mattheww/2023-07_divzero
ehuss Jul 18, 2023
a0ae62b
Fix merge queue building twice.
ehuss Jul 18, 2023
451a8e4
Improve wording of unsafe proof obligations.
gregschmit Jul 19, 2023
fd8abed
Merge pull request #1379 from gregschmit/gns/callee-to-caller-change
ehuss Jul 19, 2023
67f4153
Operator expressions: make the note about division by zero clearer.
mattheww Jul 19, 2023
5377523
Merge pull request #1384 from mattheww/2023-07_divzero-b
ehuss Jul 20, 2023
e94fb3d
Merge pull request #1273 from RalfJung/const-ub
ehuss Jul 20, 2023
69a6f70
Clarify UB around immutability & mutation
ivanbakel Jul 24, 2023
70886e3
Define immutability UB in terms of bytes
ivanbakel Jul 24, 2023
f12eaec
Style fixups in immutability UB
ivanbakel Jul 25, 2023
a64394d
Merge pull request #1385 from ivanbakel/immutable-data-UB-clarification
ehuss Jul 27, 2023
9cd5c5a
Merge pull request #1383 from ehuss/fix-queue
ehuss Jul 29, 2023
2a8068e
Merge pull request #1307 from Lokathor/patch-1
ehuss Aug 1, 2023
f193405
add section about implied bounds
lcnr Sep 5, 2022
f01e75f
review
lcnr Sep 9, 2022
903009a
review
lcnr Oct 6, 2022
c0c23b8
SPAAAAAAAAAAACE
lcnr Oct 6, 2022
a707381
Update src/trait-bounds.md
lcnr Oct 21, 2022
62fb4e0
parameters
lcnr Oct 21, 2022
6164b63
w
lcnr Oct 21, 2022
24d44b5
w
lcnr Oct 26, 2022
f24f128
Small editorial nits.
ehuss Aug 10, 2023
f7e6f04
Merge pull request #1261 from lcnr/implied-bounds
ehuss Aug 10, 2023
510e75c
Specify bit validity and padding of some types
joshlf Aug 11, 2023
e2385f9
Update type-layout.md
joshlf Aug 11, 2023
fdee104
type-layout: be more specific about 32-bit alignments
dvdhrm Aug 11, 2023
14587da
add thiscall abi
beepster4096 Sep 19, 2021
d430389
Merge pull request #1092 from DrMeepster/abi_thiscall
ehuss Aug 12, 2023
d1850ea
Clarify what `T` refers to
joshlf Aug 14, 2023
c83f2ca
Update conditional-compilation.md
evanperrygrove-somewear Aug 16, 2023
3c36417
Merge pull request #1395 from evanperrygrove-somewear/master
ehuss Aug 16, 2023
c6d4744
Update `type-layout.md` for `repr(Rust)`
Centri3 Aug 17, 2023
9f9e7a7
Add `the-default-representation` anchor
Centri3 Aug 17, 2023
629466d
we reserve the right to reduce our amount of UB
RalfJung Aug 19, 2023
2e43046
Update type-layout.md
joshlf Aug 19, 2023
2f82b7f
Update type-layout.md
joshlf Aug 19, 2023
61c6349
Update src/type-layout.md
joshlf Aug 21, 2023
bbc8063
Update type-layout.md
joshlf Aug 21, 2023
effbdc1
Merge pull request #1396 from Centri3/repr-rust
ehuss Aug 26, 2023
d3a66eb
Update boolean.md
joshlf Aug 28, 2023
5795f3a
Update textual.md
joshlf Aug 28, 2023
80ec146
Update numeric.md
joshlf Aug 28, 2023
8f92a7d
Update pointer.md
joshlf Aug 28, 2023
746a359
Update type-layout.md
joshlf Aug 28, 2023
ea1110b
Apply suggestions from code review
joshlf Sep 6, 2023
13b5af8
Update pointer.md
joshlf Sep 6, 2023
b5ae836
implementations.md typo fix
chrissimpkins Sep 9, 2023
cef4aaf
Merge pull request #1399 from chrissimpkins/patch-1
ehuss Sep 9, 2023
ee7c676
Merge pull request #1392 from joshlf/joshlf-patch-1
ehuss Sep 9, 2023
192178f
Guarantee `char` layout
joshlf Sep 11, 2023
434bd02
more wording tweaks
RalfJung Sep 12, 2023
5262e1c
Merge pull request #1397 from RalfJung/less-ub-in-the-future
ehuss Sep 18, 2023
9d351cc
docs: Fix links to ECMA standards in `attributes.md`
ghoseb Sep 26, 2023
06db8fa
Merge pull request #1408 from ghoseb/patch-1
ehuss Sep 26, 2023
d82c9ac
Adjust for RPITIT and AFIT
compiler-errors Sep 26, 2023
b29823c
replace 'UB on raw ptr deref' with UB on place projection/access
RalfJung Jul 31, 2023
051d5d7
explain place alignment
RalfJung Aug 22, 2023
142b2ed
Merge pull request #1387 from RalfJung/raw-ptr-ub
ehuss Oct 7, 2023
fae136c
nomem, readonly also means no fences
RalfJung Oct 9, 2023
5d015eb
Doc: Add the RISC-V stabilized target features
coastalwhite Oct 10, 2023
a6d7cc3
Fix temporary drop scope for last expression.
tczajka Oct 11, 2023
6e836c8
Merge pull request #1416 from tczajka/fix_temporary_last_expression
matthewjasper Oct 11, 2023
8ce1106
Guarantee that raw pointer conversions preserve slice element count
joshlf Oct 11, 2023
b6089dd
Update operator-expr.md
joshlf Oct 11, 2023
6dc7d63
Update type-coercions.md
joshlf Oct 11, 2023
2fe40f8
Update operator-expr.md
joshlf Oct 11, 2023
16fd3c0
Merge pull request #1409 from compiler-errors/ref
ehuss Oct 14, 2023
c7690f1
pure requires readonly or nomem
RalfJung Oct 17, 2023
ed4811d
Update src/expressions/operator-expr.md
joshlf Oct 26, 2023
b321771
Update operator-expr.md
joshlf Oct 26, 2023
ec979de
Merge pull request #1415 from coastalwhite/stabilize-riscv-target-fea…
ehuss Oct 30, 2023
8947db0
Merge pull request #1401 from joshlf/patch-2
ehuss Oct 30, 2023
d035af9
Stabilize Wasm target features that are in phase 4 and 5
daxpedda Oct 31, 2023
85cb1dc
tokens.md: Add <- to the Punctuation table
mattheww Nov 1, 2023
b8a39d3
Merge pull request #1413 from RalfJung/nofence
ehuss Nov 4, 2023
ad09bb0
Remove extra blank lines.
ehuss Nov 4, 2023
cd8193e
Merge pull request #1417 from joshlf/patch-3
ehuss Nov 4, 2023
e8ddd3c
paths.md: document standalone `self` in a method body
mattheww Nov 19, 2023
8332955
Reference wildcard patterns from underscore expr
riking Nov 20, 2023
7f1e24a
use md extension instead of html
ehuss Nov 21, 2023
6a66f10
Merge pull request #1428 from riking/patch-1
ehuss Nov 21, 2023
75d2d5d
Merge pull request #1427 from mattheww/2023-11_lone_self
ehuss Nov 21, 2023
a28f858
type-layout.md: Warn about repr(align)/repr(packed) and field order
joshlf Nov 22, 2023
01a12f2
Merge pull request #1430 from joshlf/patch-2
ehuss Nov 22, 2023
ae1eb71
Document C string literal tokens (`c"..."` and `cr#"..."#`).
jmillikin Nov 3, 2023
21a27e1
Merge pull request #1423 from jmillikin/c-str-literals
ehuss Dec 2, 2023
1b00b70
Fix note on `self` coercion
madsmtm Dec 2, 2023
692d216
Merge pull request #1431 from madsmtm/fix-self-coercion-note
matthewjasper Dec 4, 2023
46ed38d
Document object unsafety of async-fn-in-trait
kpreid Dec 8, 2023
f9f5b5b
Merge pull request #1435 from kpreid/patch-1
ehuss Dec 10, 2023
ed33f75
pure asm blocks must terminate
RalfJung Dec 26, 2023
8eda943
adjust wording
RalfJung Dec 26, 2023
dc74a75
Use proper footnote for number literals `_` separator note
Jules-Bertholet Dec 29, 2023
ad9a69c
Use real markdown footnote for `#` sets.
ehuss Dec 29, 2023
3565c79
Merge pull request #1444 from Jules-Bertholet/patch-1
ehuss Dec 29, 2023
2610acf
Document `target_abi`
ChrisDenton Jan 4, 2024
8c77e8b
Merge pull request #1424 from mattheww/2023-11_larrow
ehuss Jan 8, 2024
09b003a
Literal expressions: document non-C-string textual literals
mattheww Jan 14, 2024
7e3c5c3
tokens.md: remove sentence about the type of byte string literals
mattheww Jan 21, 2024
659f856
Move discussion of string continuations from tokens.md to literal-exp…
mattheww Jan 22, 2024
00a2ac6
tokens.md: link to specific headings in literal-expr.md
mattheww Jan 22, 2024
a393aaf
Update reference for https://github.com/rust-lang/rust/pull/119172.
nnethercote Jan 22, 2024
d4eac74
Merge pull request #1452 from mattheww/2024-01_string_literal_expr
ehuss Jan 27, 2024
e848fbc
Merge pull request #1442 from RalfJung/asm-terminate
ehuss Jan 27, 2024
a0b1195
Merge pull request #1450 from nnethercote/nul-in-c-str-literal
ehuss Jan 27, 2024
075739d
Literal expressions: document C-string literals
mattheww Jan 27, 2024
52dadd7
tokens.md: remove sentence about the type of C string literals
mattheww Jan 27, 2024
3fb728d
update patterns.md for const pattern RFC
RalfJung Jan 26, 2024
fa56fdb
Lexical structure: move the description of CRLF normalization
mattheww Jan 27, 2024
5f51269
lexical structure: move the description of BOM-removal
mattheww Jan 28, 2024
e364b6c
lexical structure: move the description of shebang-removal
mattheww Jan 28, 2024
8ba3c49
Input format: note about include! macros
mattheww Jan 28, 2024
eada9ba
Say that Struct patterns can match enum values
mattheww Jan 29, 2024
c6049ba
Cover enums in the refutability rule for tuple struct patterns
mattheww Jan 29, 2024
deac889
Use "null byte" rather than "zero byte" when talking about C string l…
mattheww Jan 30, 2024
9329dc4
Merge pull request #1457 from mattheww/2024-01_c_string_literal_expr
ehuss Jan 30, 2024
50a2c87
Document importing `main`
clubby789 Jan 30, 2024
8c6c7cd
Update lifetime-elision.md
felix-andreas Feb 5, 2024
19ae8c5
Fix markdown backslash for FLOAT_LITERAL
ehuss Feb 5, 2024
5be836c
Merge pull request #1464 from ehuss/fix-backslash
ehuss Feb 7, 2024
8c0b6a8
Merge pull request #1463 from andreasfelix/patch-1
matthewjasper Feb 9, 2024
31f0c2c
Fix a typo in external-blocks.md
yutannihilation Feb 12, 2024
8227666
Merge pull request #1467 from yutannihilation/patch-1
ehuss Feb 12, 2024
0bf5d4e
Add docs for `#[collapse_debuginfo]` attribute
petrochenkov Feb 13, 2024
bb16609
Use standard template introducing an attribute.
ehuss Feb 14, 2024
224b6c5
Use em-dash separator
ehuss Feb 14, 2024
4e9c91f
Place `rustc` behavior in a side note.
ehuss Feb 14, 2024
860fe4a
Use semantic line wrapping.
ehuss Feb 14, 2024
c495b96
Link `collapse_debuginfo` in the index of built-in attributes.
ehuss Feb 14, 2024
e33f255
Fix grammar for TypePathFn
ehuss Oct 10, 2022
9104f17
Merge pull request #1281 from ehuss/fix-TypePathFn
ehuss Feb 15, 2024
db390b7
Update aarch64 target feature docs to match LLVM
adamgemmell Jan 25, 2024
1a23297
Cleanup wrapping, whitespace, etc. in `README.md`
traviscross Feb 19, 2024
81b8df4
Add `rust-toolchain.toml` and revise README
traviscross Feb 19, 2024
8c7cdd3
Document semantics of various pointer casts
udoprog Jan 22, 2024
405242b
Merge pull request #1470 from adamgemmell/dev/adagem01/target-feature…
ehuss Feb 21, 2024
72fb626
Add redirect for slice-dst-pointer-to-pointer-cast
ehuss Feb 21, 2024
97c9ad1
Semantic line wrapping.
ehuss Feb 21, 2024
b25c20b
Merge pull request #1451 from udoprog/document-ptr-casts
ehuss Feb 21, 2024
8c2500c
Merge pull request #1474 from traviscross/TC/improve-readme
ehuss Feb 21, 2024
3417f86
Merge pull request #1446 from ChrisDenton/target-abi
ehuss Feb 25, 2024
08e5cd4
Say that struct patterns can match union values
mattheww Feb 27, 2024
1afcfd9
Merge pull request #1460 from mattheww/2024-01_patterns
ehuss Feb 28, 2024
7bd81a6
tokens.md: say that lifetime-like tokens can't be immediately followe…
mattheww Mar 4, 2024
5440070
Merge pull request #1479 from mattheww/2024-03_lifetime_tokens
ehuss Mar 6, 2024
5afb503
Merge pull request #1459 from mattheww/2024-01_input_format
ehuss Mar 6, 2024
684b549
add support for ATB in reference
compiler-errors Mar 7, 2024
9ad55f0
Fix copy/paste error
compiler-errors Mar 8, 2024
6c77f49
Update src/paths.md
compiler-errors Mar 8, 2024
81fe01a
Add the `#[diagnostic]` attribute namespace and the
weiznich Jan 18, 2024
5baf87c
Apply suggestions from code review
weiznich Jan 19, 2024
99b19d9
Apply more review suggestions manually
weiznich Jan 19, 2024
5e29b01
Various fixes and editing.
ehuss Mar 12, 2024
659915c
Literal expressions: fix mistake in the definition of unicode escapes
mattheww Mar 19, 2024
be4f7be
Merge pull request #1483 from mattheww/2024-03_unicode_escape_fix
ehuss Mar 19, 2024
b6779f4
Merge pull request #1481 from compiler-errors/atb
ehuss Mar 20, 2024
824b915
Merge pull request #1461 from clubby789/imported-main
ehuss Mar 20, 2024
0b153cb
fix typo of shebang
aoyama-val Mar 24, 2024
984b36e
Merge pull request #1486 from aoyama-val/patch-1
ehuss Mar 25, 2024
a7a8682
Fix clippy warning in procedural macro example
yotamofek Mar 30, 2024
1e1fec3
Merge pull request #1488 from yotamofek/patch-1
ehuss Apr 1, 2024
1c03c9d
Merge pull request #1393 from dvdhrm/pr/align32
ehuss Apr 3, 2024
52874b8
Update on_unimplemented for format string changes.
ehuss Apr 3, 2024
5569491
Merge pull request #1449 from weiznich/diagnostic_namespace
ehuss Apr 3, 2024
b4311de
Fix link to RISC-V Zkt spec; it was pointing to Zkr
jlokier Apr 14, 2024
ec0065f
Document how `non_exhaustive` interacts with tuple and unit-like stru…
kpreid Apr 14, 2024
a60221a
Merge pull request #1490 from jlokier/patch-1
ehuss Apr 15, 2024
076a798
Replace “min()” visibility notation with English.
kpreid Apr 15, 2024
585b9bc
Merge pull request #1491 from kpreid/neunit
ehuss Apr 15, 2024
4f47e3f
Update clone reference to include closures
conradludgate Apr 16, 2024
a432cf4
Expand and clarify primitive alignment
kpreid Apr 16, 2024
330ef95
Clone: Also mention closures that don't capture anything
ehuss Apr 17, 2024
735c5db
Merge pull request #1492 from conradludgate/patch-1
ehuss Apr 17, 2024
5e68de3
Merge pull request #1493 from kpreid/patch-1
ehuss Apr 20, 2024
5854fcc
Merge pull request #1420 from daxpedda/wasm-target-feature-phase-4-5
ehuss Apr 21, 2024
2d51a2a
Add an example of collapse_debuginfo
ehuss Apr 27, 2024
5181795
Merge pull request #1468 from petrochenkov/debmac
ehuss Apr 27, 2024
01c8196
Add const blocks
nbdd0121 Nov 7, 2022
c6719b5
mention associated consts
RalfJung May 3, 2024
2f63507
clarifications
RalfJung May 7, 2024
95ab920
patterns: include new exclusive range patterns
MultisampledNight Mar 22, 2024
5e8b3f6
Merge pull request #1484 from MultisampledNight/excl-range-patterns
ehuss May 7, 2024
efdc9b6
Small editorial updates for const blocks.
ehuss May 8, 2024
e356977
Merge pull request #1295 from nbdd0121/master
ehuss May 10, 2024
d33e4b0
document guarantee about evaluation of associated consts and const bl…
RalfJung May 10, 2024
1bf2cdc
Merge pull request #1497 from RalfJung/const-eval-guarantee
ehuss May 25, 2024
0e07fc5
Merge pull request #1456 from RalfJung/const-pattern
ehuss May 27, 2024
8251778
Merge PR #1040: Add "scopes" chapter
traviscross May 28, 2024
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
4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: CI
on: [push, pull_request]
on:
pull_request:
merge_group:

jobs:
test:
Expand Down
57 changes: 30 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# The Rust Language Reference

This document is the primary reference for the Rust programming language.
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
Expand All @@ -9,52 +10,54 @@ what we have for now.

## Dependencies

- rustc (the Rust compiler).
- [mdbook](https://rust-lang.github.io/mdBook/) (use `cargo install mdbook` to install it).
- rust nightly (you would be required to set your Rust version to the nightly version to make sure all tests pass)
- Nightly Rust
- [mdbook](https://rust-lang.github.io/mdBook/)

## Build steps
## Installing dependencies

To build the project, follow the steps given below :
First, ensure that you have a recent copy of the nightly Rust compiler
installed, as this is needed in order to run the tests:

Clone the project by downloading the ZIP from the [GitHub page](https://github.com/rust-lang/reference) or
run the following command:

```
git clone https://github.com/rust-lang/reference
```sh
rustup toolchain install nightly
```

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

```sh
cd reference
cargo install --locked mdbook
```

To run the tests, you would need to set the Rust version to the nightly release. You can do this by executing the following command:
## Building

To build the Reference, first clone the project:

```shell
rustup override set nightly
```sh
git clone https://github.com/rust-lang/reference.git
```

This will set the nightly version only for your the current project.
(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`.)

If you wish to set Rust nightly for all your projects, you can run the command:
[download]: https://github.com/rust-lang/reference/archive/refs/heads/master.zip

```shell
rustup default nightly
Now change your current directory to the working directory:

```sh
cd reference
```

Now, run the following command to test the code snippets to catch compilation errors:
To test all of the code examples in the Reference, run:

```shell
```sh
mdbook test
```


To generate a local instance of the book, run:
To build the Reference locally (in `build/`) and open it in a web
browser, run:

```sh
mdbook build
mdbook build --open
```

The generated HTML will be in the `book` folder.
3 changes: 3 additions & 0 deletions book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ author = "The Rust Project Developers"
[output.html]
additional-css = ["theme/reference.css"]
git-repository-url = "https://github.com/rust-lang/reference/"
edit-url-template = "https://github.com/rust-lang/reference/edit/master/{path}"

[output.html.redirect]
"/expressions/enum-variant-expr.html" = "struct-expr.html"
"/unsafe-blocks.html" = "unsafe-keyword.html"
"/unsafe-functions.html" = "unsafe-keyword.html"

[rust]
edition = "2021"
2 changes: 2 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[toolchain]
channel = "nightly"
4 changes: 2 additions & 2 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
- [Code generation](attributes/codegen.md)
- [Limits](attributes/limits.md)
- [Type System](attributes/type_system.md)
- [Debugger](attributes/debugger.md)

- [Statements and expressions](statements-and-expressions.md)
- [Statements](statements.md)
Expand Down Expand Up @@ -118,8 +119,7 @@
- [Inline assembly](inline-assembly.md)

- [Unsafety](unsafety.md)
- [Unsafe functions](unsafe-functions.md)
- [Unsafe blocks](unsafe-blocks.md)
- [The `unsafe` keyword](unsafe-keyword.md)
- [Behavior considered undefined](behavior-considered-undefined.md)
- [Behavior not considered unsafe](behavior-not-considered-unsafe.md)

Expand Down
19 changes: 16 additions & 3 deletions src/attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ struct S {
pub fn f() {}
```

> Note: `rustc` currently recognizes the tools "clippy" and "rustfmt".
> Note: `rustc` currently recognizes the tools "clippy", "rustfmt" and "diagnostic".

## Built-in attributes index

Expand Down Expand Up @@ -224,10 +224,14 @@ The following is an index of all built-in attributes.
- [`allow`], [`warn`], [`deny`], [`forbid`] — Alters the default lint level.
- [`deprecated`] — Generates deprecation notices.
- [`must_use`] — Generates a lint for unused values.
- [`diagnostic::on_unimplemented`] — Hints the compiler to emit a certain error
message if a trait is not implemented.
- ABI, linking, symbols, and FFI
- [`link`] — Specifies a native library to link with an `extern` block.
- [`link_name`] — Specifies the name of the symbol for functions or statics
in an `extern` block.
- [`link_ordinal`] — Specifies the ordinal of the symbol for functions or
statics in an `extern` block.
- [`no_link`] — Prevents linking an extern crate.
- [`repr`] — Controls type layout.
- [`crate_type`] — Specifies the type of crate (library, executable, etc.).
Expand All @@ -246,6 +250,7 @@ The following is an index of all built-in attributes.
- [`no_builtins`] — Disables use of certain built-in functions.
- [`target_feature`] — Configure platform-specific code generation.
- [`track_caller`] - Pass the parent call location to `std::panic::Location::caller()`.
- [`instruction_set`] - Specify the instruction set used to generate a functions code
- Documentation
- `doc` — Specifies documentation. See [The Rustdoc Book] for more
information. [Doc comments] are transformed into `doc` attributes.
Expand All @@ -268,10 +273,13 @@ The following is an index of all built-in attributes.
- Type System
- [`non_exhaustive`] — Indicate that a type will have more fields/variants
added in future.
- Debugger
- [`debugger_visualizer`] — Embeds a file that specifies debugger output for a type.
- [`collapse_debuginfo`] — Controls how macro invocations are encoded in debuginfo.

[Doc comments]: comments.md#doc-comments
[ECMA-334]: https://www.ecma-international.org/publications/standards/Ecma-334.htm
[ECMA-335]: https://www.ecma-international.org/publications/standards/Ecma-335.htm
[ECMA-334]: https://www.ecma-international.org/publications-and-standards/standards/ecma-334/
[ECMA-335]: https://www.ecma-international.org/publications-and-standards/standards/ecma-335/
[Expression Attributes]: expressions.md#expression-attributes
[IDENTIFIER]: identifiers.md
[RAW_STRING_LITERAL]: tokens.md#raw-string-literals
Expand All @@ -286,8 +294,10 @@ The following is an index of all built-in attributes.
[`cfg_attr`]: conditional-compilation.md#the-cfg_attr-attribute
[`cfg`]: conditional-compilation.md#the-cfg-attribute
[`cold`]: attributes/codegen.md#the-cold-attribute
[`collapse_debuginfo`]: attributes/debugger.md#the-collapse_debuginfo-attribute
[`crate_name`]: crates-and-source-files.md#the-crate_name-attribute
[`crate_type`]: linkage.md
[`debugger_visualizer`]: attributes/debugger.md#the-debugger_visualizer-attribute
[`deny`]: attributes/diagnostics.md#lint-check-attributes
[`deprecated`]: attributes/diagnostics.md#the-deprecated-attribute
[`derive`]: attributes/derive.md
Expand All @@ -296,7 +306,9 @@ The following is an index of all built-in attributes.
[`global_allocator`]: runtime.md#the-global_allocator-attribute
[`ignore`]: attributes/testing.md#the-ignore-attribute
[`inline`]: attributes/codegen.md#the-inline-attribute
[`instruction_set`]: attributes/codegen.md#the-instruction_set-attribute
[`link_name`]: items/external-blocks.md#the-link_name-attribute
[`link_ordinal`]: items/external-blocks.md#the-link_ordinal-attribute
[`link_section`]: abi.md#the-link_section-attribute
[`link`]: items/external-blocks.md#the-link-attribute
[`macro_export`]: macros-by-example.md#path-based-scope
Expand Down Expand Up @@ -344,3 +356,4 @@ The following is an index of all built-in attributes.
[closure]: expressions/closure-expr.md
[function pointer]: types/function-pointer.md
[variadic functions]: items/external-blocks.html#variadic-functions
[`diagnostic::on_unimplemented`]: attributes/diagnostics.md#the-diagnosticon_unimplemented-attribute
Loading