about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-05-22 07:19:03 +0200
committerGitHub <noreply@github.com>2025-05-22 07:19:03 +0200
commit79f0a97783fa7622d7296a36010c8848643672df (patch)
treeabcd2e7e9b49c2f1e0f9ec59bc0c70ddecc7ed85
parent1735f843afde549d8306a18fb1cd25690c70a7ed (diff)
parent8cdfabd230282f11a04de6d638546bf52ba0bf24 (diff)
downloadrust-79f0a97783fa7622d7296a36010c8848643672df.tar.gz
rust-79f0a97783fa7622d7296a36010c8848643672df.zip
Rollup merge of #141364 - aDotInTheVoid:atttrdocss, r=GuillaumeGomez
rustdoc-json: Remove false docs and add test for inline attribute

The docs about how `#[inline]` was represented isn't true. Updates the comment, and adds a test.

CC #137645

r? `@GuillaumeGomez`
-rw-r--r--src/rustdoc-json-types/lib.rs8
-rw-r--r--tests/rustdoc-json/attrs/inline.rs11
2 files changed, 12 insertions, 7 deletions
diff --git a/src/rustdoc-json-types/lib.rs b/src/rustdoc-json-types/lib.rs
index 64223b5b758..0b8a9065294 100644
--- a/src/rustdoc-json-types/lib.rs
+++ b/src/rustdoc-json-types/lib.rs
@@ -180,19 +180,13 @@ pub struct Item {
     ///
     /// Does not include `#[deprecated]` attributes: see the [`Self::deprecation`] field instead.
     ///
-    /// Some attributes appear in pretty-printed Rust form, regardless of their formatting
+    /// Attributes appear in pretty-printed Rust form, regardless of their formatting
     /// in the original source code. For example:
     /// - `#[non_exhaustive]` and `#[must_use]` are represented as themselves.
     /// - `#[no_mangle]` and `#[export_name]` are also represented as themselves.
     /// - `#[repr(C)]` and other reprs also appear as themselves,
     ///   though potentially with a different order: e.g. `repr(i8, C)` may become `repr(C, i8)`.
     ///   Multiple repr attributes on the same item may be combined into an equivalent single attr.
-    ///
-    /// Other attributes may appear debug-printed. For example:
-    /// - `#[inline]` becomes something similar to `#[attr="Inline(Hint)"]`.
-    ///
-    /// As an internal implementation detail subject to change, this debug-printing format
-    /// is currently equivalent to the HIR pretty-printing of parsed attributes.
     pub attrs: Vec<String>,
     /// Information about the item’s deprecation, if present.
     pub deprecation: Option<Deprecation>,
diff --git a/tests/rustdoc-json/attrs/inline.rs b/tests/rustdoc-json/attrs/inline.rs
new file mode 100644
index 00000000000..74f5f36f03f
--- /dev/null
+++ b/tests/rustdoc-json/attrs/inline.rs
@@ -0,0 +1,11 @@
+//@ is "$.index[?(@.name=='just_inline')].attrs" '["#[inline]"]'
+#[inline]
+pub fn just_inline() {}
+
+//@ is "$.index[?(@.name=='inline_always')].attrs" '["#[inline(always)]"]'
+#[inline(always)]
+pub fn inline_always() {}
+
+//@ is "$.index[?(@.name=='inline_never')].attrs" '["#[inline(never)]"]'
+#[inline(never)]
+pub fn inline_never() {}