Skip to content

Commit cdf2a8f

Browse files
Rename standalone doctest attribute into standalone-crate
1 parent 612796c commit cdf2a8f

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
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
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` 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
421+
//! ```standalone-crate
422422
//! let location = std::panic::Location::caller();
423423
//! assert_eq!(location.line(), 4);
424424
//! ```

src/librustdoc/doctest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ impl CreateRunnableDocTests {
837837
let is_standalone = !doctest.can_be_merged
838838
|| scraped_test.langstr.compile_fail
839839
|| scraped_test.langstr.test_harness
840-
|| scraped_test.langstr.standalone
840+
|| scraped_test.langstr.standalone_crate
841841
|| self.rustdoc_options.nocapture
842842
|| self.rustdoc_options.test_args.iter().any(|arg| arg == "--show-output");
843843
if is_standalone {

src/librustdoc/doctest/make.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl DocTestBuilder {
4848
) -> Self {
4949
let can_merge_doctests = can_merge_doctests
5050
&& lang_str.is_some_and(|lang_str| {
51-
!lang_str.compile_fail && !lang_str.test_harness && !lang_str.standalone
51+
!lang_str.compile_fail && !lang_str.test_harness && !lang_str.standalone_crate
5252
});
5353

5454
let SourceInfo { crate_attrs, maybe_crate_attrs, crates, everything_else } =

src/librustdoc/html/markdown.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ pub(crate) struct LangString {
871871
pub(crate) rust: bool,
872872
pub(crate) test_harness: bool,
873873
pub(crate) compile_fail: bool,
874-
pub(crate) standalone: bool,
874+
pub(crate) standalone_crate: bool,
875875
pub(crate) error_codes: Vec<String>,
876876
pub(crate) edition: Option<Edition>,
877877
pub(crate) added_classes: Vec<String>,
@@ -1194,7 +1194,7 @@ impl Default for LangString {
11941194
rust: true,
11951195
test_harness: false,
11961196
compile_fail: false,
1197-
standalone: false,
1197+
standalone_crate: false,
11981198
error_codes: Vec::new(),
11991199
edition: None,
12001200
added_classes: Vec::new(),
@@ -1264,8 +1264,8 @@ impl LangString {
12641264
seen_rust_tags = !seen_other_tags || seen_rust_tags;
12651265
data.no_run = true;
12661266
}
1267-
LangStringToken::LangToken("standalone") => {
1268-
data.standalone = true;
1267+
LangStringToken::LangToken("standalone-crate") => {
1268+
data.standalone_crate = true;
12691269
seen_rust_tags = !seen_other_tags || seen_rust_tags;
12701270
}
12711271
LangStringToken::LangToken(x) if x.starts_with("edition") => {

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
4+
//! ```standalone-crate
55
//! foo::init();
66
//! ```
77
8-
/// ```standalone
8+
/// ```standalone-crate
99
/// foo::init();
1010
/// ```
1111
pub fn init() {

0 commit comments

Comments
 (0)