Skip to content

Commit 6f5f21a

Browse files
Rename doctest attribute standalone-crate into standalone_crate for coherency
1 parent 632fed8 commit 6f5f21a

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

library/core/src/panic/location.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl<'a> Location<'a> {
4444
///
4545
/// # Examples
4646
///
47-
/// ```standalone-crate
47+
/// ```standalone_crate
4848
/// use std::panic::Location;
4949
///
5050
/// /// Returns the [`Location`] at which it is called.

src/doc/rustdoc/src/write-documentation/documentation-tests.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -414,11 +414,11 @@ In some cases, doctests cannot be merged. For example, if you have:
414414
The problem with this code is that, if you change any other doctests, it'll likely break when
415415
runing `rustdoc --test`, making it tricky to maintain.
416416

417-
This is where the `standalone-crate` attribute comes in: it tells `rustdoc` that a doctest
417+
This is where the `standalone_crate` attribute comes in: it tells `rustdoc` that a doctest
418418
should not be merged with the others. So the previous code should use it:
419419

420420
```rust
421-
//! ```standalone-crate
421+
//! ```standalone_crate
422422
//! let location = std::panic::Location::caller();
423423
//! assert_eq!(location.line(), 4);
424424
//! ```

src/librustdoc/html/markdown.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1264,7 +1264,7 @@ impl LangString {
12641264
seen_rust_tags = !seen_other_tags || seen_rust_tags;
12651265
data.no_run = true;
12661266
}
1267-
LangStringToken::LangToken("standalone-crate") => {
1267+
LangStringToken::LangToken("standalone_crate") => {
12681268
data.standalone_crate = true;
12691269
seen_rust_tags = !seen_other_tags || seen_rust_tags;
12701270
}
@@ -1315,12 +1315,12 @@ impl LangString {
13151315
"use `test_harness` to run functions marked `#[test]` instead of a \
13161316
potentially-implicit `main` function",
13171317
),
1318-
"standalone" | "standalone_crate" => {
1318+
"standalone" | "standalone_crate" | "standalone-crate" => {
13191319
if let Some(extra) = extra
13201320
&& extra.sp.at_least_rust_2024()
13211321
{
13221322
Some(
1323-
"use `standalone-crate` to compile this code block \
1323+
"use `standalone_crate` to compile this code block \
13241324
separately",
13251325
)
13261326
} else {

tests/run-make/doctests-merge/doctest-standalone.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#![crate_name = "foo"]
22
#![crate_type = "lib"]
33

4-
//! ```standalone-crate
4+
//! ```standalone_crate
55
//! foo::init();
66
//! ```
77
8-
/// ```standalone-crate
8+
/// ```standalone_crate
99
/// foo::init();
1010
/// ```
1111
pub fn init() {

tests/rustdoc-ui/doctest/standalone-warning-2024.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
//! bla
1212
//! ```
1313
//!
14-
//! ```standalone_crate
14+
//! ```standalone-crate
1515
//! bla
1616
//! ```

tests/rustdoc-ui/doctest/standalone-warning-2024.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ error: unknown attribute `standalone`
55
11 | | //! bla
66
12 | | //! ```
77
13 | | //!
8-
14 | | //! ```standalone_crate
8+
14 | | //! ```standalone-crate
99
15 | | //! bla
1010
16 | | //! ```
1111
| |_______^
1212
|
13-
= help: use `standalone-crate` to compile this code block separately
13+
= help: use `standalone_crate` to compile this code block separately
1414
= help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
1515
note: the lint level is defined here
1616
--> $DIR/standalone-warning-2024.rs:8:9
@@ -19,19 +19,19 @@ note: the lint level is defined here
1919
| ^^^^^^^^
2020
= note: `#[deny(rustdoc::invalid_codeblock_attributes)]` implied by `#[deny(warnings)]`
2121

22-
error: unknown attribute `standalone_crate`
22+
error: unknown attribute `standalone-crate`
2323
--> $DIR/standalone-warning-2024.rs:10:1
2424
|
2525
10 | / //! ```standalone
2626
11 | | //! bla
2727
12 | | //! ```
2828
13 | | //!
29-
14 | | //! ```standalone_crate
29+
14 | | //! ```standalone-crate
3030
15 | | //! bla
3131
16 | | //! ```
3232
| |_______^
3333
|
34-
= help: use `standalone-crate` to compile this code block separately
34+
= help: use `standalone_crate` to compile this code block separately
3535
= help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
3636

3737
error: aborting due to 2 previous errors

tests/rustdoc-ui/doctest/standalone-warning.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
//! bla
66
//! ```
77
//!
8-
//! ```standalone_crate
8+
//! ```standalone-crate
99
//! bla
1010
//! ```

0 commit comments

Comments
 (0)