Skip to content

Commit c9f68e6

Browse files
committed
Merge PR #325: Rename doctest standalone tag
2 parents c7ebae2 + 9215f25 commit c9f68e6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/rust-2024/rustdoc-doctests.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ This change is only available in the 2024 Edition to avoid potential incompatibi
4040

4141
[^implementation]: For more information on the details of how this work, see ["Doctests - How were they improved?"](https://blog.guillaume-gomez.fr/articles/2024-08-17+Doctests+-+How+were+they+improved%3F).
4242

43-
### Standalone tag
43+
### `standalone_crate` tag
4444

4545
In some situations it is not possible for rustdoc to combine examples into a single executable. Rustdoc will attempt to automatically detect if this is not possible. For example, a test will not be combined with others if it:
4646

@@ -50,7 +50,7 @@ In some situations it is not possible for rustdoc to combine examples into a sin
5050
* Defines any crate-wide attributes (like `#![feature(...)]`).
5151
* Defines a macro that uses `$crate`, because the `$crate` path will not work correctly.
5252

53-
However, rustdoc is not able to automatically determine *all* situations where an example cannot be combined with other examples. In these situations, you can add the `standalone` language tag to indicate that the example should be built as a separate executable. For example:
53+
However, rustdoc is not able to automatically determine *all* situations where an example cannot be combined with other examples. In these situations, you can add the `standalone_crate` language tag to indicate that the example should be built as a separate executable. For example:
5454

5555
```rust
5656
//! ```
@@ -59,10 +59,10 @@ However, rustdoc is not able to automatically determine *all* situations where a
5959
//! ```
6060
```
6161

62-
This is sensitive to the code structure of how the example is compiled and won't work with the "combined" approach because the line numbers will shift depending on how the doctests are combined. In these situations, you can add the `standalone` tag to force the example to be built separately just as it was in previous editions. E.g.:
62+
This is sensitive to the code structure of how the example is compiled and won't work with the "combined" approach because the line numbers will shift depending on how the doctests are combined. In these situations, you can add the `standalone_crate` tag to force the example to be built separately just as it was in previous editions. E.g.:
6363

6464
```rust
65-
//! ```standalone
65+
//! ```standalone_crate
6666
//! let location = std::panic::Location::caller();
6767
//! assert_eq!(location.line(), 5);
6868
//! ```
@@ -75,4 +75,4 @@ This is sensitive to the code structure of how the example is compiled and won't
7575

7676
## Migration
7777

78-
There is no automatic migration to determine which doctests need to be annotated with the `standalone` tag. It's very unlikely that any given doctest will not work correctly when migrated. We suggest that you update your crate to the 2024 Edition and then run your documentation tests and see if any fail. If one does, you will need to analyze whether it can be rewritten to be compatible with the combined approach, or alternatively, add the `standalone` tag to retain the previous behavior.
78+
There is no automatic migration to determine which doctests need to be annotated with the `standalone_crate` tag. It's very unlikely that any given doctest will not work correctly when migrated. We suggest that you update your crate to the 2024 Edition and then run your documentation tests and see if any fail. If one does, you will need to analyze whether it can be rewritten to be compatible with the combined approach, or alternatively, add the `standalone_crate` tag to retain the previous behavior.

0 commit comments

Comments
 (0)