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

Specify bit validity and padding of some types #1

Closed
wants to merge 442 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
442 commits
Select commit Hold shift + click to select a range
e1dc762
Merge pull request #1240 from pierwill/patch-1
Havvy Aug 14, 2022
3036b18
cannot cast non-exhaustive enum from foreign crate
lambinoo Aug 14, 2022
4aff5be
Revert "Unify while/while let and if/if let expressions."
compiler-errors Aug 14, 2022
db6fc4e
Revert "Add let_chains references"
compiler-errors Aug 14, 2022
8d28c49
Merge pull request #1251 from compiler-errors/revert-let-chains
ehuss Aug 14, 2022
bce9bb3
Update type_system.md
lambinoo Aug 16, 2022
e647eb1
Merge pull request #1249 from lambinoo/I-91161-non-exhaustive-cast-do…
ehuss Aug 16, 2022
8fda26b
Initial stab at docs for RFC2867
xd009642 Aug 16, 2022
ef70365
Move to US spelling
xd009642 Aug 16, 2022
e389abd
Apply feedback
xd009642 Aug 16, 2022
8919fc1
Mention ARMv5te
xd009642 Aug 17, 2022
3315bbc
Add link reference
xd009642 Aug 19, 2022
33e3271
Apply ignore
xd009642 Aug 19, 2022
d27f43f
Remove spaces at end of lines
xd009642 Aug 19, 2022
dbb8e2a
hopefully fix link
xd009642 Aug 19, 2022
d5d9829
allow to quickly edit a page directly on github
tshepang Aug 22, 2022
28d60fb
Merge pull request #1254 from tshepang/quick-edit
ehuss Aug 24, 2022
c126440
Update examples of what implements `Termination`
mattheww Aug 27, 2022
f62e93c
Merge pull request #1256 from mattheww/2022-08_termination
ehuss Aug 28, 2022
33cc59a
Clarify that 0 is a valid multiple of a type's alignment
joshlf Sep 4, 2022
4c94e39
Clarify reference on async blocks
matklad Sep 5, 2022
9ea36a3
Merge pull request #1262 from matklad/patch-2
ehuss Sep 5, 2022
e93265a
feat: use default not-equal method
BD103 Sep 6, 2022
7b1240b
One sentence, one line Patterns chapter
isHavvy Sep 8, 2022
ea7ba21
feat: do not specify not-equal at all
BD103 Sep 9, 2022
60cd80a
Add basic GATs info
jackh726 Sep 9, 2022
5e8efd6
Fix typo
jackh726 Sep 9, 2022
9f844c6
Merge pull request #1264 from BD103/patch-1
ehuss Sep 9, 2022
1ef107a
Review comments
jackh726 Sep 9, 2022
a7a54f5
Add explanation for required clauses on GATs
jackh726 Sep 10, 2022
dd84a62
Fixed second where clause location
jackh726 Sep 10, 2022
18d13e7
Merge pull request #1260 from joshlf/patch-2
ehuss Sep 10, 2022
d32ca05
Classify AsyncBlockExpression as ExpressionWithoutBlock
fmease Sep 11, 2022
dc1eeb4
Fix lifetime
jackh726 Sep 12, 2022
d6cd338
Add documentation for raw-dylib and link_ordinal
dpaoliello Jul 29, 2022
04ce4c4
Update closure-expr.md
guoci Sep 13, 2022
6630924
Merge pull request #1269 from guoci/patch-1
Havvy Sep 13, 2022
bf51d22
Document `label_break_value` in the reference
jyn514 Jul 14, 2022
b00444a
Add `sym` operands for inline assembly
Amanieu Sep 16, 2022
0763b2e
Nikos review
jackh726 Sep 16, 2022
3970ed3
Remove space
jackh726 Sep 16, 2022
37881f5
Update src/items/associated-items.md
nikomatsakis Sep 18, 2022
9d0d3c0
Merge pull request #1268 from fmease/async-block-is-expr-without-block
ehuss Sep 19, 2022
1ae7c2d
Link to default representation.
ehuss Sep 19, 2022
d2acc38
Merge pull request #1152 from Darksonn/type-layout-repr-rust-field-al…
ehuss Sep 19, 2022
300ac4b
Editorial changes for raw-dylib.
ehuss Sep 19, 2022
1887656
Merge pull request #1244 from dpaoliello/rawdylib
ehuss Sep 19, 2022
1f9de62
Update Unicode reference to match rustc implementation.
crlf0710 Sep 20, 2022
e2ac66c
Clarify wording for references.
May 25, 2022
d85c792
Merge pull request #1271 from crlf0710/unicode15
ehuss Sep 20, 2022
a7cdac3
Merge pull request #1223 from blldce/blldce-patch-1
ehuss Sep 20, 2022
328e227
Use semver-compliant example version
syvb Sep 24, 2022
578fd2e
Merge pull request #1272 from Smittyvb/patch-3
ehuss Sep 24, 2022
a87587e
Rewrite Range Patterns with Half Open ranges
isHavvy Sep 11, 2022
32caa7d
mention the extra const UB
RalfJung Sep 25, 2022
6c8431f
Address review comments on Range Pattern commit.
isHavvy Sep 27, 2022
da28385
Update tokens.md
hkBst Sep 27, 2022
575d859
Alpha-rename "Loop expressions" chapter to "Loops and other breakable…
pnkfelix Sep 27, 2022
1656d81
Merge pull request #1275 from Havvy/one-line-one-sentence-patterns
ehuss Sep 27, 2022
bf1453f
Merge pull request #1276 from hkBst/patch-1
ehuss Sep 27, 2022
f24b8d4
merge unsafe-block and unsafe-function into one page
RalfJung Sep 28, 2022
3c8acda
Review comments
jackh726 Sep 28, 2022
1423936
update unsafe docs
RalfJung Sep 29, 2022
d1e4ea1
apply feedback
RalfJung Sep 30, 2022
b5ff71d
Merge pull request #1278 from RalfJung/unsafe
ehuss Oct 3, 2022
2325d95
Remove unstable API mention
Mark-Simulacrum Oct 3, 2022
3c55838
Merge pull request #1171 from Mark-Simulacrum/atomic-cfg
ehuss Oct 4, 2022
d6864a4
Merge pull request #1263 from jyn514/label-break-value
pnkfelix Oct 4, 2022
3e10ae3
Document let else statements
est31 Feb 3, 2022
a50e43e
Add example
est31 Sep 20, 2022
9e6a8c0
let bindings can now be refutable too
est31 Sep 26, 2022
3d1ca95
Merge pull request #1156 from est31/let_else
ehuss Oct 5, 2022
cadf497
One line one sentence for main Expressions chapter.
isHavvy Sep 28, 2022
e076c6e
One line one sentence for the Statements chapter.
isHavvy Sep 29, 2022
45c47cd
One line one sentence the statements and expressions chapter.
isHavvy Sep 29, 2022
2af6d3c
Merge pull request #1277 from Havvy/one-line-expressions
ehuss Oct 5, 2022
3c9516b
Typo 'a' -> 'an'
steffahn Oct 8, 2022
f6ed74f
Merge pull request #1280 from steffahn/ana
Havvy Oct 8, 2022
6b9e4ff
Add a section on relationship between bounds and wherebounds
jackh726 Oct 19, 2022
8104645
Merge pull request #1265 from jackh726/gats
nikomatsakis Oct 19, 2022
50a597c
type parameter `Self` is unsized by default
fmease Oct 19, 2022
b8d2c58
Merge pull request #1270 from Amanieu/asm-sym
ehuss Oct 20, 2022
7c5b80d
clarifying which row contains the example
amab8901 Oct 21, 2022
0276e07
Merge pull request #1287 from amab8901/patch-2
Havvy Oct 21, 2022
4ea7c5d
Merge pull request #1274 from Havvy/half-open-ranges
ehuss Oct 25, 2022
4e0edd1
Fix a minor typo in the "Higher-ranked trait bounds" section
ohno418 Oct 26, 2022
45f85e1
Update enum documentation for arbitrary_enum_discriminant feature.
jswrenn Jul 14, 2019
3b5ac6c
"e.g." -> "for example"
jswrenn Jul 15, 2019
f8ac109
Applied suggestions from Havvy
fee1-dead Jul 4, 2021
3d4745b
Apply Suggestions
fee1-dead Aug 19, 2021
5d9300c
Update terminology from fieldless to unit-only
fee1-dead Oct 28, 2022
8a86959
Add a comma
EFanZh Oct 31, 2022
66754d6
update aliasing rules section of the reference
RalfJung Oct 31, 2022
9f0cc13
Merge pull request #1289 from EFanZh/patch-1
ehuss Oct 31, 2022
7110c8e
add back link
RalfJung Oct 31, 2022
3657967
clarify liveness
RalfJung Oct 31, 2022
e05229d
clarify "upper bound"
RalfJung Nov 1, 2022
2af818d
forward reference to 'dangling'
RalfJung Nov 1, 2022
219e336
Disallow newline directly following `//`
autumnull Nov 4, 2022
0ec6d52
Document native library modifier `verbatim`
petrochenkov Nov 13, 2022
87f527b
Add an anchor to the "forwarding macro fragments" paragraph
danielhenrymantilla Nov 15, 2022
04f289a
Fix header hierarchy
danielhenrymantilla Nov 15, 2022
5100e84
Merge pull request #1300 from danielhenrymantilla/patch-1
ehuss Nov 15, 2022
fc039cf
Merge pull request #1294 from autumnull/patch-1
ehuss Nov 15, 2022
212b1c9
Merge pull request #1288 from ohno418/fix-typo-in-hrtb
ehuss Nov 17, 2022
c47e316
Fix backtick
ehuss Nov 17, 2022
6a5431b
Merge pull request #1253 from xd009642/doc/rfc2867
ehuss Nov 17, 2022
1c70ae7
literal-expr.md: say that suffixes are removed before interpreting nu…
mattheww Nov 20, 2022
c36b3c2
tokens.md: add one more case to the "Reserved forms" lexer block
mattheww Nov 20, 2022
b333c25
tokens.md: remove the "examples of invalid integer literals"
mattheww Nov 20, 2022
ccde77e
Numeric literals: say that the parser is now more lenient
mattheww Nov 20, 2022
018b14b
tokens.md: add optional SUFFIX to the Lexer blocks for non-numeric li…
mattheww Nov 20, 2022
3d45616
Clearly specify the instruction_set inlining restrictions
Lokathor Nov 23, 2022
e203b97
Merge pull request #1290 from RalfJung/aliasing
ehuss Nov 25, 2022
c7a39ca
Merge pull request #1305 from mattheww/2022-11_parse_all_suffixes
ehuss Nov 25, 2022
7ab0619
Document the efiapi ABI
nicholasbishop Nov 27, 2022
b17be54
Merge pull request #1299 from petrochenkov/stabverb
ehuss Nov 29, 2022
8ca80a1
repalce `crateid` term with `crate_name`
yejunjin Nov 30, 2022
e279799
Merge pull request #1310 from crabrs/patch-1
ehuss Nov 30, 2022
3ae6268
Merge pull request #1285 from fmease/self-is-unsized-by-default
ehuss Dec 5, 2022
d8ad654
Enable triagebot shortcuts
ehuss Jan 6, 2023
426e8bd
Merge pull request #1314 from ehuss/triagebot-shortcut
ehuss Jan 7, 2023
f9c4fad
Add links to definitions of terminology ...
steffahn Jan 7, 2023
ca43062
Merge pull request #1315 from steffahn/links-for-in-h-a-e-t-s-express…
ehuss Jan 7, 2023
c351aa7
Clarify exactly which kinds of enums can be `as` casted.
ehuss Jan 8, 2023
1b38681
Normalize section header capitalization.
ehuss Jan 8, 2023
9af0aa4
Use span instead of <a> for anchor placement.
ehuss Jan 8, 2023
4f32346
Add anchor for removed section.
ehuss Jan 8, 2023
cc07ac0
Merge pull request #1055 from fee1-dead/arbitrary_enum_discriminant
ehuss Jan 8, 2023
08b97f9
Update field-expr.md
kklibo Jan 12, 2023
2cb0ed9
Merge pull request #1318 from kklibo/patch-1
ehuss Jan 13, 2023
df9643a
Update codegen.md
Lokathor Jan 18, 2023
fd6e375
Correct for trait-bounds.md
jamesreprise Jan 20, 2023
c4202a8
Merge pull request #1319 from jamesreprise/patch-1
ehuss Jan 20, 2023
8789558
Fix typo “assigment”
steffahn Jan 23, 2023
894afd4
Fix two more typos
steffahn Jan 23, 2023
22882fb
Merge pull request #1322 from steffahn/assigment
ehuss Jan 23, 2023
7b6a860
Relax ordering rules for `asm!` operands
Amanieu Jan 27, 2023
99ed3f8
remove confusing words
tshepang Jan 31, 2023
b1f11e4
Remove "expression for a match arm" wording
tmandry Jan 31, 2023
27dc03f
Clarify match arm "expression" as "body expression"
tmandry Jan 31, 2023
088b6d8
Merge pull request #1325 from rust-lang/tmandry-patch-1
ehuss Feb 1, 2023
0f29748
Merge pull request #1324 from tshepang/patch-2
ehuss Feb 1, 2023
8d49ecf
fix place expression context example
RalfJung Feb 2, 2023
b9ccb09
Merge pull request #1327 from RalfJung/place-expr
ehuss Feb 2, 2023
86691a1
Clarify that unnamed constants are always evaluated at compile time
XrXr Feb 3, 2023
e844f95
Eliminate 'half open' terminology from range pattern grammar
dtolnay Feb 8, 2023
e5adb99
Merge pull request #1330 from dtolnay-contrib/rangepattern
ehuss Feb 8, 2023
a9afb04
Merge pull request #1309 from nicholasbishop/bishop-add-efiapi
ehuss Feb 14, 2023
021889f
Adjust language to also cover named constants
XrXr Feb 14, 2023
a6190a8
Document `cmpxchg16b` target feature
Nugine Feb 16, 2023
33d68e1
Merge pull request #1331 from Nugine/cmpxchg16b
ehuss Feb 28, 2023
650dd01
Fix example for non-x86 targets
ehuss Feb 28, 2023
f37b1c1
Document movbe target feature
calebzulawski Mar 3, 2023
cec5aaf
Document f16c target feature
ehuss Mar 4, 2023
e185cb9
fix: Typo/reference
alexpovel Mar 6, 2023
93137b0
Merge pull request #1338 from alexpovel/patch-1
ehuss Mar 6, 2023
945a2bd
fix typo
tshepang Mar 9, 2023
846bdbb
Merge pull request #1339 from tshepang/patch-2
ehuss Mar 9, 2023
24c87f6
Merge pull request #1336 from calebzulawski/movbe
ehuss Mar 11, 2023
ebab1cd
Merge pull request #1328 from XrXr/unamed-const-eval-timing
nikomatsakis Mar 14, 2023
960ec1f
Inline assembly: Fix repeated and unordered items in guaranteed direc…
chirsz-ever Mar 19, 2023
3bb0f03
Merge pull request #1341 from chirsz-ever/patch-1
ehuss Mar 19, 2023
aa9c70b
Improve labeled blocks documentation
est31 Mar 19, 2023
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
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
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"
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
8 changes: 8 additions & 0 deletions src/attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ The following is an index of all built-in attributes.
- [`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 +248,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,6 +271,8 @@ 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.

[Doc comments]: comments.md#doc-comments
[ECMA-334]: https://www.ecma-international.org/publications/standards/Ecma-334.htm
Expand All @@ -288,6 +293,7 @@ The following is an index of all built-in attributes.
[`cold`]: attributes/codegen.md#the-cold-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 +302,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
125 changes: 117 additions & 8 deletions src/attributes/codegen.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ error to specify a feature for a target architecture that the crate is not
being compiled for.

It is [undefined behavior] to call a function that is compiled with a feature
that is not supported on the current platform the code is running on.
that is not supported on the current platform the code is running on, *except*
if the platform explicitly documents this to be safe.

Functions marked with `target_feature` are not inlined into a context that
does not support the given features. The `#[inline(always)]` attribute may not
Expand All @@ -75,19 +76,24 @@ The following is a list of the available feature names.

#### `x86` or `x86_64`

This platform requires that `#[target_feature]` is only applied to [`unsafe`
Executing code with unsupported features is undefined behavior on this platform.
Hence this platform requires that `#[target_feature]` is only applied to [`unsafe`
functions][unsafe function].

Feature | Implicitly Enables | Description
------------|--------------------|-------------------
`adx` | | [ADX] — Multi-Precision Add-Carry Instruction Extensions
`aes` | `sse2` | [AES] — Advanced Encryption Standard
`avx` | `sse4.2` | [AVX] — Advanced Vector Extensions
`avx2` | `avx` | [AVX2] — Advanced Vector Extensions 2
`bmi1` | | [BMI1] — Bit Manipulation Instruction Sets
`bmi2` | | [BMI2] — Bit Manipulation Instruction Sets 2
`cmpxchg16b`| | [`cmpxchg16b`] - Compares and exchange 16 bytes (128 bits) of data atomically
`f16c` | `avx` | [F16C] — 16-bit floating point conversion instructions
`fma` | `avx` | [FMA3] — Three-operand fused multiply-add
`fxsr` | | [`fxsave`] and [`fxrstor`] — Save and restore x87 FPU, MMX Technology, and SSE State
`lzcnt` | | [`lzcnt`] — Leading zeros count
`movbe` | | [`movbe`] - Move data after swapping bytes
`pclmulqdq` | `sse2` | [`pclmulqdq`] — Packed carry-less multiplication quadword
`popcnt` | | [`popcnt`] — Count of bits set to 1
`rdrand` | | [`rdrand`] — Read random number
Expand All @@ -106,15 +112,19 @@ Feature | Implicitly Enables | Description

<!-- Keep links near each table to make it easier to move and update. -->

[ADX]: https://en.wikipedia.org/wiki/Intel_ADX
[AES]: https://en.wikipedia.org/wiki/AES_instruction_set
[AVX]: https://en.wikipedia.org/wiki/Advanced_Vector_Extensions
[AVX2]: https://en.wikipedia.org/wiki/Advanced_Vector_Extensions#AVX2
[BMI1]: https://en.wikipedia.org/wiki/Bit_Manipulation_Instruction_Sets
[BMI2]: https://en.wikipedia.org/wiki/Bit_Manipulation_Instruction_Sets#BMI2
[`cmpxchg16b`]: https://www.felixcloutier.com/x86/cmpxchg8b:cmpxchg16b
[F16C]: https://en.wikipedia.org/wiki/F16C
[FMA3]: https://en.wikipedia.org/wiki/FMA_instruction_set
[`fxsave`]: https://www.felixcloutier.com/x86/fxsave
[`fxrstor`]: https://www.felixcloutier.com/x86/fxrstor
[`lzcnt`]: https://www.felixcloutier.com/x86/lzcnt
[`movbe`]: https://www.felixcloutier.com/x86/movbe
[`pclmulqdq`]: https://www.felixcloutier.com/x86/pclmulqdq
[`popcnt`]: https://www.felixcloutier.com/x86/popcnt
[`rdrand`]: https://en.wikipedia.org/wiki/RdRand
Expand All @@ -131,10 +141,77 @@ Feature | Implicitly Enables | Description
[`xsaveopt`]: https://www.felixcloutier.com/x86/xsaveopt
[`xsaves`]: https://www.felixcloutier.com/x86/xsaves

#### `aarch64`

This platform requires that `#[target_feature]` is only applied to [`unsafe`
functions][unsafe function].

Further documentation on these features can be found in the [ARM Architecture
Reference Manual], or elsewhere on [developer.arm.com].

[ARM Architecture Reference Manual]: https://developer.arm.com/documentation/ddi0487/latest
[developer.arm.com]: https://developer.arm.com

> ***Note***: The following pairs of features should both be marked as enabled
> or disabled together if used:
> - `paca` and `pacg`, which LLVM currently implements as one feature.


Feature | Implicitly Enables | Feature Name
---------------|--------------------|-------------------
`aes` | `neon` | FEAT_AES - Advanced <abbr title="Single Instruction Multiple Data">SIMD</abbr> AES instructions
`bf16` | | FEAT_BF16 - BFloat16 instructions
`bti` | | FEAT_BTI - Branch Target Identification
`crc` | | FEAT_CRC - CRC32 checksum instructions
`dit` | | FEAT_DIT - Data Independent Timing instructions
`dotprod` | | FEAT_DotProd - Advanced SIMD Int8 dot product instructions
`dpb` | | FEAT_DPB - Data cache clean to point of persistence
`dpb2` | | FEAT_DPB2 - Data cache clean to point of deep persistence
`f32mm` | `sve` | FEAT_F32MM - SVE single-precision FP matrix multiply instruction
`f64mm` | `sve` | FEAT_F64MM - SVE double-precision FP matrix multiply instruction
`fcma` | `neon` | FEAT_FCMA - Floating point complex number support
`fhm` | `fp16` | FEAT_FHM - Half-precision FP FMLAL instructions
`flagm` | | FEAT_FlagM - Conditional flag manipulation
`fp16` | `neon` | FEAT_FP16 - Half-precision FP data processing
`frintts` | | FEAT_FRINTTS - Floating-point to int helper instructions
`i8mm` | | FEAT_I8MM - Int8 Matrix Multiplication
`jsconv` | `neon` | FEAT_JSCVT - JavaScript conversion instruction
`lse` | | FEAT_LSE - Large System Extension
`lor` | | FEAT_LOR - Limited Ordering Regions extension
`mte` | | FEAT_MTE - Memory Tagging Extension
`neon` | | FEAT_FP & FEAT_AdvSIMD - Floating Point and Advanced SIMD extension
`pan` | | FEAT_PAN - Privileged Access-Never extension
`paca` | | FEAT_PAuth - Pointer Authentication (address authentication)
`pacg` | | FEAT_PAuth - Pointer Authentication (generic authentication)
`pmuv3` | | FEAT_PMUv3 - Performance Monitors extension (v3)
`rand` | | FEAT_RNG - Random Number Generator
`ras` | | FEAT_RAS - Reliability, Availability and Serviceability extension
`rcpc` | | FEAT_LRCPC - Release consistent Processor Consistent
`rcpc2` | `rcpc` | FEAT_LRCPC2 - RcPc with immediate offsets
`rdm` | | FEAT_RDM - Rounding Double Multiply accumulate
`sb` | | FEAT_SB - Speculation Barrier
`sha2` | `neon` | FEAT_SHA1 & FEAT_SHA256 - Advanced SIMD SHA instructions
`sha3` | `sha2` | FEAT_SHA512 & FEAT_SHA3 - Advanced SIMD SHA instructions
`sm4` | `neon` | FEAT_SM3 & FEAT_SM4 - Advanced SIMD SM3/4 instructions
`spe` | | FEAT_SPE - Statistical Profiling Extension
`ssbs` | | FEAT_SSBS - Speculative Store Bypass Safe
`sve` | `fp16` | FEAT_SVE - Scalable Vector Extension
`sve2` | `sve` | FEAT_SVE2 - Scalable Vector Extension 2
`sve2-aes` | `sve2`, `aes` | FEAT_SVE_AES - SVE AES instructions
`sve2-sm4` | `sve2`, `sm4` | FEAT_SVE_SM4 - SVE SM4 instructions
`sve2-sha3` | `sve2`, `sha3` | FEAT_SVE_SHA3 - SVE SHA3 instructions
`sve2-bitperm` | `sve2` | FEAT_SVE_BitPerm - SVE Bit Permute
`tme` | | FEAT_TME - Transactional Memory Extension
`vh` | | FEAT_VHE - Virtualization Host Extensions

#### `wasm32` or `wasm64`

This platform allows `#[target_feature]` to be applied to both safe and
[`unsafe` functions][unsafe function].
`#[target_feature]` may be used with both safe and
[`unsafe` functions][unsafe function] on Wasm platforms. It is impossible to
cause undefined behavior via the `#[target_feature]` attribute because
attempting to use instructions unsupported by the Wasm engine will fail at load
time without the risk of being interpreted in a way different from what the
compiler expected.

Feature | Description
------------|-------------------
Expand All @@ -149,8 +226,8 @@ enabling or disabling compilation of code based on compile-time settings. Note
that this option is not affected by the `target_feature` attribute, and is
only driven by the features enabled for the entire crate.

See the [`is_x86_feature_detected`] macro in the standard library for runtime
feature detection on the x86 platforms.
See the [`is_x86_feature_detected`] or [`is_aarch64_feature_detected`] macros
in the standard library for runtime feature detection on these platforms.

> Note: `rustc` has a default set of features enabled for each target and CPU.
> The CPU may be chosen with the [`-C target-cpu`] flag. Individual features
Expand Down Expand Up @@ -267,16 +344,48 @@ trait object whose methods are attributed.
[_MetaListNameValueStr_]: ../attributes.md#meta-item-attribute-syntax
[`-C target-cpu`]: ../../rustc/codegen-options/index.html#target-cpu
[`-C target-feature`]: ../../rustc/codegen-options/index.html#target-feature
[`is_x86_feature_detected`]: ../../std/macro.is_x86_feature_detected.html
[`is_x86_feature_detected`]: ../../std/arch/macro.is_x86_feature_detected.html
[`is_aarch64_feature_detected`]: ../../std/arch/macro.is_aarch64_feature_detected.html
[`target_feature` conditional compilation option]: ../conditional-compilation.md#target_feature
[attribute]: ../attributes.md
[attributes]: ../attributes.md
[functions]: ../items/functions.md
[target architecture]: ../conditional-compilation.md#target_arch
[trait]: ../items/traits.md
[undefined behavior]: ../behavior-considered-undefined.md
[unsafe function]: ../unsafe-functions.md
[unsafe function]: ../unsafe-keyword.md
[rust-abi]: ../items/external-blocks.md#abi
[`core::intrinsics::caller_location`]: ../../core/intrinsics/fn.caller_location.html
[`core::panic::Location::caller`]: ../../core/panic/struct.Location.html#method.caller
[`Location`]: ../../core/panic/struct.Location.html

## The `instruction_set` attribute

The *`instruction_set` [attribute]* may be applied to a function to control which instruction set the function will be generated for.
This allows mixing more than one instruction set in a single program on CPU architectures that support it.
It uses the [_MetaListPath_] syntax, and a path comprised of the architecture family name and instruction set name.

[_MetaListPath_]: ../attributes.md#meta-item-attribute-syntax

It is a compilation error to use the `instruction_set` attribute on a target that does not support it.

### On ARM

For the `ARMv4T` and `ARMv5te` architectures, the following are supported:

* `arm::a32` - Generate the function as A32 "ARM" code.
* `arm::t32` - Generate the function as T32 "Thumb" code.

<!-- ignore: arm-only -->
```rust,ignore
#[instruction_set(arm::a32)]
fn foo_arm_code() {}

#[instruction_set(arm::t32)]
fn bar_thumb_code() {}
```

Using the `instruction_set` attribute has the following effects:

* If the address of the function is taken as a function pointer, the low bit of the address will be set to 0 (arm) or 1 (thumb) depending on the instruction set.
* Any inline assembly in the function must use the specified instruction set instead of the target default.
Loading