Skip to content

Commit 484d3f2

Browse files
ehusstraviscross
authored andcommitted
Switch all note blocks to use admonition syntax
This will allow us to maintain consistency, and apply styling.
1 parent 2a202cc commit 484d3f2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+216
-114
lines changed

src/attributes.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@ struct S {
227227
pub fn f() {}
228228
```
229229

230-
> Note: `rustc` currently recognizes the tools "clippy", "rustfmt", "diagnostic",
230+
> [!NOTE]
231+
> `rustc` currently recognizes the tools "clippy", "rustfmt", "diagnostic",
231232
> "miri" and "rust_analyzer".
232233
233234
r[attributes.builtin]

src/attributes/codegen.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ The *`inline` [attribute]* suggests that a copy of the attributed function
2626
should be placed in the caller, rather than generating code to call the
2727
function where it is defined.
2828

29-
> ***Note***: The `rustc` compiler automatically inlines functions based on
29+
> [!NOTE]
30+
> The `rustc` compiler automatically inlines functions based on
3031
> internal heuristics. Incorrectly inlining functions can make the program
3132
> slower, so this attribute should be used with care.
3233
@@ -39,7 +40,8 @@ There are three ways to use the inline attribute:
3940
* `#[inline(never)]` *suggests* that an inline expansion should never be
4041
performed.
4142

42-
> ***Note***: `#[inline]` in every form is a hint, with no *requirements*
43+
> [!NOTE]
44+
> `#[inline]` in every form is a hint, with no *requirements*
4345
> on the language to place a copy of the attributed function in the caller.
4446
4547
r[attributes.codegen.cold]
@@ -229,7 +231,8 @@ Reference Manual], or elsewhere on [developer.arm.com].
229231
[ARM Architecture Reference Manual]: https://developer.arm.com/documentation/ddi0487/latest
230232
[developer.arm.com]: https://developer.arm.com
231233

232-
> ***Note***: The following pairs of features should both be marked as enabled
234+
> [!NOTE]
235+
> The following pairs of features should both be marked as enabled
233236
> or disabled together if used:
234237
> - `paca` and `pacg`, which LLVM currently implements as one feature.
235238
@@ -390,7 +393,8 @@ r[attributes.codegen.target_feature.remark-rt]
390393
See the [`is_x86_feature_detected`] or [`is_aarch64_feature_detected`] macros
391394
in the standard library for runtime feature detection on these platforms.
392395

393-
> Note: `rustc` has a default set of features enabled for each target and CPU.
396+
> [!NOTE]
397+
> `rustc` has a default set of features enabled for each target and CPU.
394398
> The CPU may be chosen with the [`-C target-cpu`] flag. Individual features
395399
> may be enabled or disabled for an entire crate with the
396400
> [`-C target-feature`] flag.
@@ -427,10 +431,12 @@ fn f() {
427431
}
428432
```
429433

430-
> Note: `core` provides [`core::panic::Location::caller`] for observing caller locations. It wraps
434+
> [!NOTE]
435+
> `core` provides [`core::panic::Location::caller`] for observing caller locations. It wraps
431436
> the [`core::intrinsics::caller_location`] intrinsic implemented by `rustc`.
432437
433-
> Note: because the resulting `Location` is a hint, an implementation may halt its walk up the stack
438+
> [!NOTE]
439+
> Because the resulting `Location` is a hint, an implementation may halt its walk up the stack
434440
> early. See [Limitations](#limitations) for important caveats.
435441
436442
#### Examples
@@ -504,7 +510,8 @@ appears to observers to have been called at the attributed function's definition
504510
caller information across virtual calls. A common example of this coercion is the creation of a
505511
trait object whose methods are attributed.
506512

507-
> Note: The aforementioned shim for function pointers is necessary because `rustc` implements
513+
> [!NOTE]
514+
> The aforementioned shim for function pointers is necessary because `rustc` implements
508515
> `track_caller` in a codegen context by appending an implicit parameter to the function ABI, but
509516
> this would be unsound for an indirect call because the parameter is not a part of the function's
510517
> type and a given function pointer type may or may not refer to a function with the attribute. The

src/attributes/debugger.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ r[attributes.debugger.collapse_debuginfo.default]
173173
The `external` behavior is the default for macros that don't have this attribute, unless they are built-in macros.
174174
For built-in macros the default is `yes`.
175175

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.
177178
178179
```rust
179180
#[collapse_debuginfo(yes)]

src/attributes/diagnostics.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ r[attributes.diagnostics.lint.forbid]
3737
* `#[forbid(C)]` is the same as `deny(C)`, but also forbids changing the lint
3838
level afterwards,
3939

40-
> Note: The lint checks supported by `rustc` can be found via `rustc -W help`,
40+
> [!NOTE]
41+
> The lint checks supported by `rustc` can be found via `rustc -W help`,
4142
> along with their default settings and are documented in the [rustc book].
4243
4344
```rust
@@ -98,7 +99,8 @@ pub mod m3 {
9899
}
99100
```
100101

101-
> Note: `rustc` allows setting lint levels on the
102+
> [!NOTE]
103+
> `rustc` allows setting lint levels on the
102104
> [command-line][rustc-lint-cli], and also supports [setting
103105
> caps][rustc-lint-caps] on the lints that are reported.
104106
@@ -222,7 +224,8 @@ pub fn another_example() {
222224
}
223225
```
224226

225-
> Note: The behavior of `#[expect(unfulfilled_lint_expectations)]` is currently
227+
> [!NOTE]
228+
> The behavior of `#[expect(unfulfilled_lint_expectations)]` is currently
226229
> defined to always generate the `unfulfilled_lint_expectations` lint.
227230
228231
r[attributes.diagnostics.lint.group]
@@ -297,7 +300,8 @@ fn foo() {
297300
}
298301
```
299302

300-
> Note: `rustc` currently recognizes the tool lints for "[clippy]" and "[rustdoc]".
303+
> [!NOTE]
304+
> `rustc` currently recognizes the tool lints for "[clippy]" and "[rustdoc]".
301305
302306
r[attributes.diagnostics.deprecated]
303307
## The `deprecated` attribute
@@ -433,7 +437,8 @@ impl Trait for i32 {
433437
r[attributes.diagnostics.must_use.trait-impl-function]
434438
When used on a function in a trait implementation, the attribute does nothing.
435439

436-
> Note: Trivial no-op expressions containing the value will not violate the
440+
> [!NOTE]
441+
> Trivial no-op expressions containing the value will not violate the
437442
> lint. Examples include wrapping the value in a type that does not implement
438443
> [`Drop`] and then not using that type and being the final expression of a
439444
> [block expression] that is not used.
@@ -452,7 +457,8 @@ When used on a function in a trait implementation, the attribute does nothing.
452457
> };
453458
> ```
454459
455-
> Note: It is idiomatic to use a [let statement] with a pattern of `_`
460+
> [!NOTE]
461+
> It is idiomatic to use a [let statement] with a pattern of `_`
456462
> when a must-used value is purposely discarded.
457463
>
458464
> ```rust
@@ -558,7 +564,8 @@ r[attributes.diagnostic.do_not_recommend]
558564
r[attributes.diagnostic.do_not_recommend.intro]
559565
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.
560566

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.
567+
> [!NOTE]
568+
> 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.
562569
>
563570
> 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.
564571

src/attributes/limits.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ r[attributes.limits.recursion_limit.syntax]
1616
It uses the [_MetaNameValueStr_]
1717
syntax to specify the recursion depth.
1818

19-
> Note: The default in `rustc` is 128.
19+
> [!NOTE]
20+
> The default in `rustc` is 128.
2021
2122
```rust,compile_fail
2223
#![recursion_limit = "4"]
@@ -44,7 +45,8 @@ r[attributes.limits.type_length_limit]
4445
## The `type_length_limit` attribute
4546

4647

47-
> **Note**: This limit is only enforced when the nightly `-Zenforce-type-length-limit` flag is active.
48+
> [!NOTE]
49+
> This limit is only enforced when the nightly `-Zenforce-type-length-limit` flag is active.
4850
>
4951
> For more information, see <https://github.com/rust-lang/rust/pull/127670>.
5052
@@ -56,7 +58,8 @@ r[attributes.limits.type_length_limit.syntax]
5658
It is applied at the [crate] level, and uses the [_MetaNameValueStr_] syntax
5759
to set the limit based on the number of type substitutions.
5860

59-
> Note: The default in `rustc` is 1048576.
61+
> [!NOTE]
62+
> The default in `rustc` is 1048576.
6063
6164
```rust,ignore
6265
#![type_length_limit = "4"]

src/attributes/testing.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ Test functions must be free, monomorphic functions that take no arguments, and t
2626
<!-- If the previous section needs updating (from "must take no arguments"
2727
onwards, also update it in the crates-and-source-files.md file -->
2828

29-
> Note: The test mode is enabled by passing the `--test` argument to `rustc`
29+
> [!NOTE]
30+
> The test mode is enabled by passing the `--test` argument to `rustc`
3031
> or using `cargo test`.
3132
3233
r[attributes.testing.test.success]
@@ -69,7 +70,8 @@ fn mytest() {
6970
}
7071
```
7172

72-
> **Note**: The `rustc` test harness supports the `--include-ignored` flag to
73+
> [!NOTE]
74+
> The `rustc` test harness supports the `--include-ignored` flag to
7375
> force ignored tests to be run.
7476
7577
r[attributes.testing.should_panic]

src/behavior-considered-undefined.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ r[undefined.runtime]
101101
* For assumptions specifically related to unwinding, see the [panic documentation][unwinding-ffi].
102102
* 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`.
103103

104-
> **Note**: Undefined behavior affects the entire program. For example, calling
104+
> [!NOTE]
105+
> Undefined behavior affects the entire program. For example, calling
105106
> a function in C that exhibits undefined behavior of C means your entire
106107
> program contains undefined behaviour that can also affect the Rust code. And
107108
> vice versa, undefined behavior in Rust can cause adverse affects on code
@@ -237,7 +238,8 @@ r[undefined.validity.valid-range]
237238
* If a type has a custom range of a valid values, then a valid value must be in that range.
238239
In the standard library, this affects [`NonNull<T>`] and [`NonZero<T>`].
239240

240-
> **Note**: `rustc` achieves this with the unstable
241+
> [!NOTE]
242+
> `rustc` achieves this with the unstable
241243
> `rustc_layout_scalar_valid_range_*` attributes.
242244
243245
r[undefined.validity.undef]

src/comments.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,15 @@ modules that occupy a source file.
7171
r[comments.doc.bare-crs]
7272
The character `U+000D` (CR) is not allowed in doc comments.
7373

74-
> **Note**: It is conventional for doc comments to contain Markdown, as expected by
74+
> [!NOTE]
75+
> It is conventional for doc comments to contain Markdown, as expected by
7576
> `rustdoc`. However, the comment syntax does not respect any internal Markdown.
7677
> ``/** `glob = "*/*.rs";` */`` terminates the comment at the first `*/`, and the
7778
> remaining code would cause a syntax error. This slightly limits the content of
7879
> block doc comments compared to line doc comments.
7980
80-
> **Note**: The sequence `U+000D` (CR) immediately followed by `U+000A` (LF) would have been previously transformed into a single `U+000A` (LF).
81+
> [!NOTE]
82+
> The sequence `U+000D` (CR) immediately followed by `U+000A` (LF) would have been previously transformed into a single `U+000A` (LF).
8183
8284
## Examples
8385

src/conditional-compilation.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ Names are written as a single identifier, such as `unix`.
5858
r[cfg.option-key-value]
5959
Key-value pairs are written as an identifier, `=`, and then a string, such as `target_arch = "x86_64"`.
6060

61-
> **Note**: Whitespace around the `=` is ignored, so `foo="bar"` and `foo = "bar"` are equivalent.
61+
> [!NOTE]
62+
> Whitespace around the `=` is ignored, so `foo="bar"` and `foo = "bar"` are equivalent.
6263
6364
r[cfg.option-key-uniqueness]
6465
Keys do not need to be unique. For example, both `feature = "std"` and `feature = "serde"` can be set at the same time.
@@ -80,10 +81,12 @@ r[cfg.options.crate]
8081
It is not possible to set a
8182
configuration option from within the source code of the crate being compiled.
8283

83-
> **Note**: For `rustc`, arbitrary-set configuration options are set using the
84+
> [!NOTE]
85+
> For `rustc`, arbitrary-set configuration options are set using the
8486
> [`--cfg`] flag. Configuration values for a specified target can be displayed with `rustc --print cfg --target $TARGET`.
8587
86-
> **Note**: Configuration options with the key `feature` are a convention used
88+
> [!NOTE]
89+
> Configuration options with the key `feature` are a convention used
8790
> by [Cargo][cargo-feature] for specifying compile-time options and optional
8891
> dependencies.
8992
@@ -422,7 +425,8 @@ fn bewitched() {}
422425
fn bewitched() {}
423426
```
424427

425-
> **Note**: The `cfg_attr` can expand to another `cfg_attr`. For example,
428+
> [!NOTE]
429+
> The `cfg_attr` can expand to another `cfg_attr`. For example,
426430
> `#[cfg_attr(target_os = "linux", cfg_attr(feature = "multithreaded", some_other_attribute))]`
427431
> is valid. This example would be equivalent to
428432
> `#[cfg_attr(all(target_os = "linux", feature ="multithreaded"), some_other_attribute)]`.

src/crates-and-source-files.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ r[crate.syntax]
77
> &nbsp;&nbsp; [_InnerAttribute_]<sup>\*</sup>\
88
> &nbsp;&nbsp; [_Item_]<sup>\*</sup>
99
10-
> Note: Although Rust, like any other language, can be implemented by an
10+
> [!NOTE]
11+
> Although Rust, like any other language, can be implemented by an
1112
> interpreter as well as a compiler, the only existing implementation is a
1213
> compiler, and the language has always been designed to be compiled. For these
1314
> reasons, this section assumes a compiler.
@@ -60,7 +61,8 @@ r[crate.attributes]
6061
The anonymous crate module can have additional attributes that
6162
apply to the crate as a whole.
6263

63-
> **Note**: The file's contents may be preceded by a [shebang].
64+
> [!NOTE]
65+
> The file's contents may be preceded by a [shebang].
6466
6567
```rust
6668
// Specify the crate name.
@@ -111,7 +113,8 @@ mod foo {
111113
use foo::bar as main;
112114
```
113115

114-
> **Note**: Types with implementations of [`Termination`] in the standard library include:
116+
> [!NOTE]
117+
> Types with implementations of [`Termination`] in the standard library include:
115118
>
116119
> * `()`
117120
> * [`!`]

0 commit comments

Comments
 (0)