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: docs/authoring.md
+4-1
Original file line number
Diff line number
Diff line change
@@ -167,9 +167,12 @@ Admonitions use a style similar to GitHub-flavored markdown, where the style nam
167
167
```markdown
168
168
> [!WARNING]
169
169
> This is a warning.
170
+
171
+
> [!NOTE]
172
+
> This is a note.
170
173
```
171
174
172
-
All this does is apply a CSS class to the blockquote. You should define the color or style of the rule in the [`theme/reference.css`](https://github.com/rust-lang/reference/blob/master/theme/reference.css)file if it isn't already defined.
175
+
The color and styling is defined in [`theme/reference.css`](https://github.com/rust-lang/reference/blob/master/theme/reference.css)and the transformation and icons are in [`mdbook-spec/src/lib.rs`](https://github.com/rust-lang/reference/blob/HEAD/mdbook-spec/src/lib.rs).
Copy file name to clipboardexpand all lines: src/attributes/codegen.md
+14-21
Original file line number
Diff line number
Diff line change
@@ -26,9 +26,8 @@ The *`inline` [attribute]* suggests that a copy of the attributed function
26
26
should be placed in the caller, rather than generating code to call the
27
27
function where it is defined.
28
28
29
-
> ***Note***: The `rustc` compiler automatically inlines functions based on
30
-
> internal heuristics. Incorrectly inlining functions can make the program
31
-
> slower, so this attribute should be used with care.
29
+
> [!NOTE]
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.
32
31
33
32
r[attributes.codegen.inline.modes]
34
33
There are three ways to use the inline attribute:
@@ -39,8 +38,8 @@ There are three ways to use the inline attribute:
39
38
*`#[inline(never)]`*suggests* that an inline expansion should never be
40
39
performed.
41
40
42
-
> ***Note***: `#[inline]` in every form is a hint, with no *requirements*
43
-
> on the language to place a copy of the attributed function in the caller.
41
+
> [!NOTE]
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.
44
43
45
44
r[attributes.codegen.cold]
46
45
### The `cold` attribute
@@ -229,8 +228,8 @@ Reference Manual], or elsewhere on [developer.arm.com].
See the [`is_x86_feature_detected`] or [`is_aarch64_feature_detected`] macros
391
390
in the standard library for runtime feature detection on these platforms.
392
391
393
-
> Note: `rustc` has a default set of features enabled for each target and CPU.
394
-
> The CPU may be chosen with the [`-C target-cpu`] flag. Individual features
395
-
> may be enabled or disabled for an entire crate with the
396
-
> [`-C target-feature`] flag.
392
+
> [!NOTE]
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.
397
394
398
395
r[attributes.codegen.track_caller]
399
396
## The `track_caller` attribute
@@ -427,11 +424,11 @@ fn f() {
427
424
}
428
425
```
429
426
430
-
> Note: `core` provides [`core::panic::Location::caller`] for observing caller locations. It wraps
431
-
> the [`core::intrinsics::caller_location`] intrinsic implemented by `rustc`.
427
+
> [!NOTE]
428
+
> `core` provides [`core::panic::Location::caller`] for observing caller locations. It wraps the [`core::intrinsics::caller_location`] intrinsic implemented by `rustc`.
432
429
433
-
> Note: because the resulting `Location` is a hint, an implementation may halt its walk up the stack
434
-
> early. See [Limitations](#limitations) for important caveats.
430
+
> [!NOTE]
431
+
> Because the resulting `Location` is a hint, an implementation may halt its walk up the stack early. See [Limitations](#limitations) for important caveats.
435
432
436
433
#### Examples
437
434
@@ -504,12 +501,8 @@ appears to observers to have been called at the attributed function's definition
504
501
caller information across virtual calls. A common example of this coercion is the creation of a
505
502
trait object whose methods are attributed.
506
503
507
-
> Note: The aforementioned shim for function pointers is necessary because `rustc` implements
508
-
> `track_caller` in a codegen context by appending an implicit parameter to the function ABI, but
509
-
> this would be unsound for an indirect call because the parameter is not a part of the function's
510
-
> type and a given function pointer type may or may not refer to a function with the attribute. The
511
-
> creation of a shim hides the implicit parameter from callers of the function pointer, preserving
512
-
> soundness.
504
+
> [!NOTE]
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 `external` behavior is the default for macros that don't have this attribute, unless they are built-in macros.
174
174
For built-in macros the default is `yes`.
175
175
176
-
> **Note**: `rustc` has a `-C collapse-macro-debuginfo` CLI option to override both the default collapsing behavior and `#[collapse_debuginfo]` attributes.
176
+
> [!NOTE]
177
+
> `rustc` has a `-C collapse-macro-debuginfo` CLI option to override both the default collapsing behavior and `#[collapse_debuginfo]` attributes.
*`#[forbid(C)]` is the same as `deny(C)`, but also forbids changing the lint
38
38
level afterwards,
39
39
40
-
> Note: The lint checks supported by `rustc` can be found via `rustc -W help`,
41
-
> along with their default settings and are documented in the [rustc book].
40
+
> [!NOTE]
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].
42
42
43
43
```rust
44
44
pubmodm1 {
@@ -98,9 +98,8 @@ pub mod m3 {
98
98
}
99
99
```
100
100
101
-
> Note: `rustc` allows setting lint levels on the
102
-
> [command-line][rustc-lint-cli], and also supports [setting
103
-
> caps][rustc-lint-caps] on the lints that are reported.
101
+
> [!NOTE]
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.
104
103
105
104
r[attributes.diagnostics.lint.reason]
106
105
### Lint Reasons
@@ -222,8 +221,8 @@ pub fn another_example() {
222
221
}
223
222
```
224
223
225
-
> Note: The behavior of `#[expect(unfulfilled_lint_expectations)]` is currently
226
-
> defined to always generate the `unfulfilled_lint_expectations` lint.
224
+
> [!NOTE]
225
+
> The behavior of `#[expect(unfulfilled_lint_expectations)]` is currently defined to always generate the `unfulfilled_lint_expectations` lint.
227
226
228
227
r[attributes.diagnostics.lint.group]
229
228
### Lint groups
@@ -297,7 +296,8 @@ fn foo() {
297
296
}
298
297
```
299
298
300
-
> Note: `rustc` currently recognizes the tool lints for "[clippy]" and "[rustdoc]".
299
+
> [!NOTE]
300
+
> `rustc` currently recognizes the tool lints for "[clippy]" and "[rustdoc]".
When used on a function in a trait implementation, the attribute does nothing.
435
435
436
-
> Note: Trivial no-op expressions containing the value will not violate the
437
-
> lint. Examples include wrapping the value in a type that does not implement
438
-
> [`Drop`] and then not using that type and being the final expression of a
439
-
> [block expression] that is not used.
436
+
> [!NOTE]
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.
440
438
>
441
439
> ```rust
442
440
> #[must_use]
@@ -452,8 +450,8 @@ When used on a function in a trait implementation, the attribute does nothing.
452
450
> };
453
451
> ```
454
452
455
-
> Note:Itisidiomatictouse a [let statement] with a pattern of `_`
456
-
> when a must-used value is purposely discarded.
453
+
> [!NOTE]
454
+
> Itisidiomatictouse a [let statement] with a pattern of `_` when a must-used value is purposely discarded.
The `#[diagnostic::do_not_recommend]` attribute is a hint to the compiler to not show the annotated trait implementation as part of a diagnostic message.
560
558
561
-
> **Note**: Suppressing the recommendation can be useful if you know that the recommendation would normally not be useful to the programmer. This often occurs with broad, blanket impls. The recommendation may send the programmer down the wrong path, or the trait implementation may be an internal detail that you don't want to expose, or the bounds may not be able to be satisfied by the programmer.
559
+
> [!NOTE]
560
+
> Suppressing the recommendation can be useful if you know that the recommendation would normally not be useful to the programmer. This often occurs with broad, blanket impls. The recommendation may send the programmer down the wrong path, or the trait implementation may be an internal detail that you don't want to expose, or the bounds may not be able to be satisfied by the programmer.
562
561
>
563
562
> For example, in an error message about a type not implementing a required trait, the compiler may find a trait implementation that would satisfy the requirements if it weren't for specific bounds in the trait implementation. The compiler may tell the user that there is an impl, but the problem is the bounds in the trait implementation. The `#[diagnostic::do_not_recommend]` attribute can be used to tell the compiler to *not* tell the user about the trait implementation, and instead simply tell the user the type doesn't implement the required trait.
Copy file name to clipboardexpand all lines: src/attributes/testing.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -26,8 +26,8 @@ Test functions must be free, monomorphic functions that take no arguments, and t
26
26
<!-- If the previous section needs updating (from "must take no arguments"
27
27
onwards, also update it in the crates-and-source-files.md file -->
28
28
29
-
> Note: The test mode is enabled by passing the `--test` argument to `rustc`
30
-
> or using `cargo test`.
29
+
> [!NOTE]
30
+
> The test mode is enabled by passing the `--test` argument to `rustc`or using `cargo test`.
31
31
32
32
r[attributes.testing.test.success]
33
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.
@@ -69,8 +69,8 @@ fn mytest() {
69
69
}
70
70
```
71
71
72
-
> **Note**: The `rustc` test harness supports the `--include-ignored` flag to
73
-
> force ignored tests to be run.
72
+
> [!NOTE]
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
+4-7
Original file line number
Diff line number
Diff line change
@@ -101,11 +101,8 @@ r[undefined.runtime]
101
101
* For assumptions specifically related to unwinding, see the [panic documentation][unwinding-ffi].
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
-
> **Note**: Undefined behavior affects the entire program. For example, calling
105
-
> a function in C that exhibits undefined behavior of C means your entire
106
-
> program contains undefined behaviour that can also affect the Rust code. And
107
-
> vice versa, undefined behavior in Rust can cause adverse affects on code
108
-
> executed by any FFI calls to other languages.
104
+
> [!NOTE]
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
+4-6
Original file line number
Diff line number
Diff line change
@@ -71,13 +71,11 @@ modules that occupy a source file.
71
71
r[comments.doc.bare-crs]
72
72
The character `U+000D` (CR) is not allowed in doc comments.
73
73
74
-
> **Note**: It is conventional for doc comments to contain Markdown, as expected by
75
-
> `rustdoc`. However, the comment syntax does not respect any internal Markdown.
76
-
> ``/** `glob = "*/*.rs";` */`` terminates the comment at the first `*/`, and the
77
-
> remaining code would cause a syntax error. This slightly limits the content of
78
-
> block doc comments compared to line doc comments.
74
+
> [!NOTE]
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.
79
76
80
-
> **Note**: The sequence `U+000D` (CR) immediately followed by `U+000A` (LF) would have been previously transformed into a single `U+000A` (LF).
77
+
> [!NOTE]
78
+
> The sequence `U+000D` (CR) immediately followed by `U+000A` (LF) would have been previously transformed into a single `U+000A` (LF).
0 commit comments