about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2024-09-27 18:03:54 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2024-09-28 18:38:10 +0200
commitcdf2a8ffc5f8af31529b44964457a7a7e9979680 (patch)
tree806a03e54752ea346f27edf76fb3cbc101d36664
parent612796c42077605fdd3c6f7dda05745d8f4dc4d8 (diff)
downloadrust-cdf2a8ffc5f8af31529b44964457a7a7e9979680.tar.gz
rust-cdf2a8ffc5f8af31529b44964457a7a7e9979680.zip
Rename `standalone` doctest attribute into `standalone-crate`
-rw-r--r--library/core/src/panic/location.rs2
-rw-r--r--src/doc/rustdoc/src/write-documentation/documentation-tests.md4
-rw-r--r--src/librustdoc/doctest.rs2
-rw-r--r--src/librustdoc/doctest/make.rs2
-rw-r--r--src/librustdoc/html/markdown.rs8
-rw-r--r--tests/run-make/doctests-merge/doctest-standalone.rs4
6 files changed, 11 insertions, 11 deletions
diff --git a/library/core/src/panic/location.rs b/library/core/src/panic/location.rs
index e2a842046a9..97408a4ac18 100644
--- a/library/core/src/panic/location.rs
+++ b/library/core/src/panic/location.rs
@@ -44,7 +44,7 @@ impl<'a> Location<'a> {
     ///
     /// # Examples
     ///
-    /// ```standalone
+    /// ```standalone-crate
     /// use std::panic::Location;
     ///
     /// /// Returns the [`Location`] at which it is called.
diff --git a/src/doc/rustdoc/src/write-documentation/documentation-tests.md b/src/doc/rustdoc/src/write-documentation/documentation-tests.md
index 7ed2e9720fe..94ef34ea5a5 100644
--- a/src/doc/rustdoc/src/write-documentation/documentation-tests.md
+++ b/src/doc/rustdoc/src/write-documentation/documentation-tests.md
@@ -414,11 +414,11 @@ In some cases, doctests cannot be merged. For example, if you have:
 The problem with this code is that, if you change any other doctests, it'll likely break when
 runing `rustdoc --test`, making it tricky to maintain.
 
-This is where the `standalone` attribute comes in: it tells `rustdoc` that a doctest
+This is where the `standalone-crate` attribute comes in: it tells `rustdoc` that a doctest
 should not be merged with the others. So the previous code should use it:
 
 ```rust
-//! ```standalone
+//! ```standalone-crate
 //! let location = std::panic::Location::caller();
 //! assert_eq!(location.line(), 4);
 //! ```
diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs
index 3ee6b24ac92..bdd6fbe8c0c 100644
--- a/src/librustdoc/doctest.rs
+++ b/src/librustdoc/doctest.rs
@@ -837,7 +837,7 @@ impl CreateRunnableDocTests {
         let is_standalone = !doctest.can_be_merged
             || scraped_test.langstr.compile_fail
             || scraped_test.langstr.test_harness
-            || scraped_test.langstr.standalone
+            || scraped_test.langstr.standalone_crate
             || self.rustdoc_options.nocapture
             || self.rustdoc_options.test_args.iter().any(|arg| arg == "--show-output");
         if is_standalone {
diff --git a/src/librustdoc/doctest/make.rs b/src/librustdoc/doctest/make.rs
index d560e3a476b..efbb332d12d 100644
--- a/src/librustdoc/doctest/make.rs
+++ b/src/librustdoc/doctest/make.rs
@@ -48,7 +48,7 @@ impl DocTestBuilder {
     ) -> Self {
         let can_merge_doctests = can_merge_doctests
             && lang_str.is_some_and(|lang_str| {
-                !lang_str.compile_fail && !lang_str.test_harness && !lang_str.standalone
+                !lang_str.compile_fail && !lang_str.test_harness && !lang_str.standalone_crate
             });
 
         let SourceInfo { crate_attrs, maybe_crate_attrs, crates, everything_else } =
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs
index b18d621478c..fbba63f9445 100644
--- a/src/librustdoc/html/markdown.rs
+++ b/src/librustdoc/html/markdown.rs
@@ -871,7 +871,7 @@ pub(crate) struct LangString {
     pub(crate) rust: bool,
     pub(crate) test_harness: bool,
     pub(crate) compile_fail: bool,
-    pub(crate) standalone: bool,
+    pub(crate) standalone_crate: bool,
     pub(crate) error_codes: Vec<String>,
     pub(crate) edition: Option<Edition>,
     pub(crate) added_classes: Vec<String>,
@@ -1194,7 +1194,7 @@ impl Default for LangString {
             rust: true,
             test_harness: false,
             compile_fail: false,
-            standalone: false,
+            standalone_crate: false,
             error_codes: Vec::new(),
             edition: None,
             added_classes: Vec::new(),
@@ -1264,8 +1264,8 @@ impl LangString {
                         seen_rust_tags = !seen_other_tags || seen_rust_tags;
                         data.no_run = true;
                     }
-                    LangStringToken::LangToken("standalone") => {
-                        data.standalone = true;
+                    LangStringToken::LangToken("standalone-crate") => {
+                        data.standalone_crate = true;
                         seen_rust_tags = !seen_other_tags || seen_rust_tags;
                     }
                     LangStringToken::LangToken(x) if x.starts_with("edition") => {
diff --git a/tests/run-make/doctests-merge/doctest-standalone.rs b/tests/run-make/doctests-merge/doctest-standalone.rs
index 134ffb58285..4b6a1c6ab61 100644
--- a/tests/run-make/doctests-merge/doctest-standalone.rs
+++ b/tests/run-make/doctests-merge/doctest-standalone.rs
@@ -1,11 +1,11 @@
 #![crate_name = "foo"]
 #![crate_type = "lib"]
 
-//! ```standalone
+//! ```standalone-crate
 //! foo::init();
 //! ```
 
-/// ```standalone
+/// ```standalone-crate
 /// foo::init();
 /// ```
 pub fn init() {