You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/attributes/codegen.md
+7-21
Original file line number
Diff line number
Diff line change
@@ -27,9 +27,7 @@ should be placed in the caller, rather than generating code to call the
27
27
function where it is defined.
28
28
29
29
> [!NOTE]
30
-
> The `rustc` compiler automatically inlines functions based on
31
-
> internal heuristics. Incorrectly inlining functions can make the program
32
-
> slower, so this attribute should be used with care.
30
+
> The `rustc` compiler automatically inlines functions based on internal heuristics. Incorrectly inlining functions can make the program slower, so this attribute should be used with care.
33
31
34
32
r[attributes.codegen.inline.modes]
35
33
There are three ways to use the inline attribute:
@@ -41,8 +39,7 @@ There are three ways to use the inline attribute:
41
39
performed.
42
40
43
41
> [!NOTE]
44
-
> `#[inline]` in every form is a hint, with no *requirements*
45
-
> on the language to place a copy of the attributed function in the caller.
42
+
> `#[inline]` in every form is a hint, with no *requirements* on the language to place a copy of the attributed function in the caller.
46
43
47
44
r[attributes.codegen.cold]
48
45
### The `cold` attribute
@@ -232,8 +229,7 @@ Reference Manual], or elsewhere on [developer.arm.com].
232
229
[developer.arm.com]: https://developer.arm.com
233
230
234
231
> [!NOTE]
235
-
> The following pairs of features should both be marked as enabled
236
-
> or disabled together if used:
232
+
> The following pairs of features should both be marked as enabled or disabled together if used:
237
233
> -`paca` and `pacg`, which LLVM currently implements as one feature.
238
234
239
235
@@ -394,10 +390,7 @@ See the [`is_x86_feature_detected`] or [`is_aarch64_feature_detected`] macros
394
390
in the standard library for runtime feature detection on these platforms.
395
391
396
392
> [!NOTE]
397
-
> `rustc` has a default set of features enabled for each target and CPU.
398
-
> The CPU may be chosen with the [`-C target-cpu`] flag. Individual features
399
-
> may be enabled or disabled for an entire crate with the
400
-
> [`-C target-feature`] flag.
393
+
> `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 may be enabled or disabled for an entire crate with the [`-C target-feature`] flag.
401
394
402
395
r[attributes.codegen.track_caller]
403
396
## The `track_caller` attribute
@@ -432,12 +425,10 @@ fn f() {
432
425
```
433
426
434
427
> [!NOTE]
435
-
> `core` provides [`core::panic::Location::caller`] for observing caller locations. It wraps
436
-
> the [`core::intrinsics::caller_location`] intrinsic implemented by `rustc`.
428
+
> `core` provides [`core::panic::Location::caller`] for observing caller locations. It wraps the [`core::intrinsics::caller_location`] intrinsic implemented by `rustc`.
437
429
438
430
> [!NOTE]
439
-
> Because the resulting `Location` is a hint, an implementation may halt its walk up the stack
440
-
> early. See [Limitations](#limitations) for important caveats.
431
+
> Because the resulting `Location` is a hint, an implementation may halt its walk up the stack early. See [Limitations](#limitations) for important caveats.
441
432
442
433
#### Examples
443
434
@@ -511,12 +502,7 @@ caller information across virtual calls. A common example of this coercion is th
511
502
trait object whose methods are attributed.
512
503
513
504
> [!NOTE]
514
-
> The aforementioned shim for function pointers is necessary because `rustc` implements
515
-
> `track_caller` in a codegen context by appending an implicit parameter to the function ABI, but
516
-
> this would be unsound for an indirect call because the parameter is not a part of the function's
517
-
> type and a given function pointer type may or may not refer to a function with the attribute. The
518
-
> creation of a shim hides the implicit parameter from callers of the function pointer, preserving
519
-
> soundness.
505
+
> The aforementioned shim for function pointers is necessary because `rustc` implements `track_caller` in a codegen context by appending an implicit parameter to the function ABI, but this would be unsound for an indirect call because the parameter is not a part of the function's type and a given function pointer type may or may not refer to a function with the attribute. The creation of a shim hides the implicit parameter from callers of the function pointer, preserving soundness.
> The lint checks supported by `rustc` can be found via `rustc -W help`,
42
-
> along with their default settings and are documented in the [rustc book].
41
+
> The lint checks supported by `rustc` can be found via `rustc -W help`, along with their default settings and are documented in the [rustc book].
43
42
44
43
```rust
45
44
pubmodm1 {
@@ -100,9 +99,7 @@ pub mod m3 {
100
99
```
101
100
102
101
> [!NOTE]
103
-
> `rustc` allows setting lint levels on the
104
-
> [command-line][rustc-lint-cli], and also supports [setting
105
-
> caps][rustc-lint-caps] on the lints that are reported.
102
+
> `rustc` allows setting lint levels on the [command-line][rustc-lint-cli], and also supports [setting caps][rustc-lint-caps] on the lints that are reported.
106
103
107
104
r[attributes.diagnostics.lint.reason]
108
105
### Lint Reasons
@@ -225,8 +222,7 @@ pub fn another_example() {
225
222
```
226
223
227
224
> [!NOTE]
228
-
> The behavior of `#[expect(unfulfilled_lint_expectations)]` is currently
229
-
> defined to always generate the `unfulfilled_lint_expectations` lint.
225
+
> The behavior of `#[expect(unfulfilled_lint_expectations)]` is currently defined to always generate the `unfulfilled_lint_expectations` lint.
When used on a function in a trait implementation, the attribute does nothing.
439
435
440
436
> [!NOTE]
441
-
> Trivial no-op expressions containing the value will not violate the
442
-
> lint. Examples include wrapping the value in a type that does not implement
443
-
> [`Drop`] and then not using that type and being the final expression of a
444
-
> [block expression] that is not used.
437
+
> Trivial no-op expressions containing the value will not violate the lint. Examples include wrapping the value in a type that does not implement [`Drop`] and then not using that type and being the final expression of a [block expression] that is not used.
445
438
>
446
439
> ```rust
447
440
> #[must_use]
@@ -458,8 +451,7 @@ When used on a function in a trait implementation, the attribute does nothing.
458
451
> ```
459
452
460
453
> [!NOTE]
461
-
> Itisidiomatictouse a [let statement] with a pattern of `_`
462
-
> when a must-used value is purposely discarded.
454
+
> Itisidiomatictouse a [let statement] with a pattern of `_` when a must-used value is purposely discarded.
Copy file name to clipboardExpand all lines: src/attributes/testing.md
+2-4
Original file line number
Diff line number
Diff line change
@@ -27,8 +27,7 @@ Test functions must be free, monomorphic functions that take no arguments, and t
27
27
onwards, also update it in the crates-and-source-files.md file -->
28
28
29
29
> [!NOTE]
30
-
> The test mode is enabled by passing the `--test` argument to `rustc`
31
-
> or using `cargo test`.
30
+
> The test mode is enabled by passing the `--test` argument to `rustc` or using `cargo test`.
32
31
33
32
r[attributes.testing.test.success]
34
33
The test harness calls the returned value's [`report`] method, and classifies the test as passed or failed depending on whether the resulting [`ExitCode`] represents successful termination.
@@ -71,8 +70,7 @@ fn mytest() {
71
70
```
72
71
73
72
> [!NOTE]
74
-
> The `rustc` test harness supports the `--include-ignored` flag to
75
-
> force ignored tests to be run.
73
+
> The `rustc` test harness supports the `--include-ignored` flag to force ignored tests to be run.
Copy file name to clipboardExpand all lines: src/behavior-considered-undefined.md
+2-7
Original file line number
Diff line number
Diff line change
@@ -102,11 +102,7 @@ r[undefined.runtime]
102
102
* The runtime assumes that a Rust stack frame is not deallocated without executing destructors for local variables owned by the stack frame. This assumption can be violated by C functions like `longjmp`.
103
103
104
104
> [!NOTE]
105
-
> Undefined behavior affects the entire program. For example, calling
106
-
> a function in C that exhibits undefined behavior of C means your entire
107
-
> program contains undefined behaviour that can also affect the Rust code. And
108
-
> vice versa, undefined behavior in Rust can cause adverse affects on code
109
-
> executed by any FFI calls to other languages.
105
+
> Undefined behavior affects the entire program. For example, calling a function in C that exhibits undefined behavior of C means your entire program contains undefined behaviour that can also affect the Rust code. And vice versa, undefined behavior in Rust can cause adverse affects on code executed by any FFI calls to other languages.
Copy file name to clipboardExpand all lines: src/comments.md
+1-5
Original file line number
Diff line number
Diff line change
@@ -72,11 +72,7 @@ r[comments.doc.bare-crs]
72
72
The character `U+000D` (CR) is not allowed in doc comments.
73
73
74
74
> [!NOTE]
75
-
> It is conventional for doc comments to contain Markdown, as expected by
76
-
> `rustdoc`. However, the comment syntax does not respect any internal Markdown.
77
-
> ``/** `glob = "*/*.rs";` */`` terminates the comment at the first `*/`, and the
78
-
> remaining code would cause a syntax error. This slightly limits the content of
79
-
> block doc comments compared to line doc comments.
75
+
> It is conventional for doc comments to contain Markdown, as expected by `rustdoc`. However, the comment syntax does not respect any internal Markdown. ``/** `glob = "*/*.rs";` */`` terminates the comment at the first `*/`, and the remaining code would cause a syntax error. This slightly limits the content of block doc comments compared to line doc comments.
80
76
81
77
> [!NOTE]
82
78
> The sequence `U+000D` (CR) immediately followed by `U+000A` (LF) would have been previously transformed into a single `U+000A` (LF).
Copy file name to clipboardExpand all lines: src/conditional-compilation.md
+3-9
Original file line number
Diff line number
Diff line change
@@ -82,13 +82,10 @@ It is not possible to set a
82
82
configuration option from within the source code of the crate being compiled.
83
83
84
84
> [!NOTE]
85
-
> For `rustc`, arbitrary-set configuration options are set using the
86
-
> [`--cfg`] flag. Configuration values for a specified target can be displayed with `rustc --print cfg --target $TARGET`.
85
+
> For `rustc`, arbitrary-set configuration options are set using the [`--cfg`] flag. Configuration values for a specified target can be displayed with `rustc --print cfg --target $TARGET`.
87
86
88
87
> [!NOTE]
89
-
> Configuration options with the key `feature` are a convention used
90
-
> by [Cargo][cargo-feature] for specifying compile-time options and optional
91
-
> dependencies.
88
+
> Configuration options with the key `feature` are a convention used by [Cargo][cargo-feature] for specifying compile-time options and optional dependencies.
92
89
93
90
r[cfg.target_arch]
94
91
### `target_arch`
@@ -426,10 +423,7 @@ fn bewitched() {}
426
423
```
427
424
428
425
> [!NOTE]
429
-
> The `cfg_attr` can expand to another `cfg_attr`. For example,
> The `cfg_attr` can expand to another `cfg_attr`. For example, `#[cfg_attr(target_os = "linux", cfg_attr(feature = "multithreaded", some_other_attribute))]` is valid. This example would be equivalent to `#[cfg_attr(all(target_os = "linux", feature ="multithreaded"), some_other_attribute)]`.
433
427
434
428
r[cfg.cfg_attr.restriction]
435
429
The `cfg_attr` attribute is allowed anywhere attributes are allowed.
Copy file name to clipboardExpand all lines: src/crates-and-source-files.md
+1-4
Original file line number
Diff line number
Diff line change
@@ -8,10 +8,7 @@ r[crate.syntax]
8
8
> [_Item_]<sup>\*</sup>
9
9
10
10
> [!NOTE]
11
-
> Although Rust, like any other language, can be implemented by an
12
-
> interpreter as well as a compiler, the only existing implementation is a
13
-
> compiler, and the language has always been designed to be compiled. For these
14
-
> reasons, this section assumes a compiler.
11
+
> Although Rust, like any other language, can be implemented by an interpreter as well as a compiler, the only existing implementation is a compiler, and the language has always been designed to be compiled. For these reasons, this section assumes a compiler.
15
12
16
13
r[crate.compile-time]
17
14
Rust's semantics obey a *phase distinction* between compile-time and
Copy file name to clipboardExpand all lines: src/destructors.md
+3-8
Original file line number
Diff line number
Diff line change
@@ -212,10 +212,7 @@ smallest scope that contains the expression and is one of the following:
212
212
* The entirety of the tail expression of a block ([destructors.scope.temporary.edition2024]).
213
213
214
214
> [!NOTE]
215
-
> The [scrutinee] of a `match` expression is not a temporary scope, so
216
-
> temporaries in the scrutinee can be dropped after the `match` expression. For
217
-
> example, the temporary for `1` in `match 1 { ref mut z => z };` lives until
218
-
> the end of the statement.
215
+
> The [scrutinee] of a `match` expression is not a temporary scope, so temporaries in the scrutinee can be dropped after the `match` expression. For example, the temporary for `1` in `match 1 { ref mut z => z };` lives until the end of the statement.
219
216
220
217
r[destructors.scope.temporary.edition2024]
221
218
> **Edition differences**: The 2024 edition added two new temporary scope narrowing rules: `if let` temporaries are dropped before the `else` block, and temporaries of tail expressions of blocks are dropped immediately after the tail expression is evaluated.
> The exact rules for temporary lifetime extension are subject to
319
-
> change. This is describing the current behavior only.
315
+
> The exact rules for temporary lifetime extension are subject to change. This is describing the current behavior only.
320
316
321
317
r[destructors.scope.lifetime-extension.let]
322
318
The temporary scopes for expressions in `let` statements are sometimes
@@ -433,8 +429,7 @@ and [`std::mem::ManuallyDrop`] provides a wrapper to prevent a
433
429
variable or field from being dropped automatically.
434
430
435
431
> [!NOTE]
436
-
> Preventing a destructor from being run via [`std::mem::forget`] or other means is safe even if it has a type that isn't `'static`.
437
-
> Besides the places where destructors are guaranteed to run as defined by this document, types may *not* safely rely on a destructor being run for soundness.
432
+
> Preventing a destructor from being run via [`std::mem::forget`] or other means is safe even if it has a type that isn't `'static`. Besides the places where destructors are guaranteed to run as defined by this document, types may *not* safely rely on a destructor being run for soundness.
Copy file name to clipboardExpand all lines: src/expressions/block-expr.md
+1-2
Original file line number
Diff line number
Diff line change
@@ -66,8 +66,7 @@ r[expr.block.value]
66
66
Blocks are always [value expressions] and evaluate the last operand in value expression context.
67
67
68
68
> [!NOTE]
69
-
> This can be used to force moving a value if really needed.
70
-
> For example, the following example fails on the call to `consume_self` because the struct was moved out of `s` in the block expression.
69
+
> This can be used to force moving a value if really needed. For example, the following example fails on the call to `consume_self` because the struct was moved out of `s` in the block expression.
Copy file name to clipboardExpand all lines: src/expressions/call-expr.md
+1-3
Original file line number
Diff line number
Diff line change
@@ -45,9 +45,7 @@ r[expr.call.desugar.ambiguity]
45
45
Function calls may need to be fully qualified, depending on the ambiguity of a call in light of in-scope items.
46
46
47
47
> [!NOTE]
48
-
> In the past, the terms "Unambiguous Function Call Syntax", "Universal Function Call Syntax", or "UFCS", have been used in documentation, issues, RFCs, and other community writings.
49
-
> However, these terms lack descriptive power and potentially confuse the issue at hand.
50
-
> We mention them here for searchability's sake.
48
+
> In the past, the terms "Unambiguous Function Call Syntax", "Universal Function Call Syntax", or "UFCS", have been used in documentation, issues, RFCs, and other community writings. However, these terms lack descriptive power and potentially confuse the issue at hand. We mention them here for searchability's sake.
51
49
52
50
r[expr.call.desugar.limits]
53
51
Several situations often occur which result in ambiguities about the receiver or referent of method or associated function calls.
0 commit comments