Skip to content

Commit 8cdfabd

Browse files
committed
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 https://www.github.com/rust-lang/rust/issues/137645
1 parent 414482f commit 8cdfabd

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

src/rustdoc-json-types/lib.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,19 +180,13 @@ pub struct Item {
180180
///
181181
/// Does not include `#[deprecated]` attributes: see the [`Self::deprecation`] field instead.
182182
///
183-
/// Some attributes appear in pretty-printed Rust form, regardless of their formatting
183+
/// Attributes appear in pretty-printed Rust form, regardless of their formatting
184184
/// in the original source code. For example:
185185
/// - `#[non_exhaustive]` and `#[must_use]` are represented as themselves.
186186
/// - `#[no_mangle]` and `#[export_name]` are also represented as themselves.
187187
/// - `#[repr(C)]` and other reprs also appear as themselves,
188188
/// though potentially with a different order: e.g. `repr(i8, C)` may become `repr(C, i8)`.
189189
/// Multiple repr attributes on the same item may be combined into an equivalent single attr.
190-
///
191-
/// Other attributes may appear debug-printed. For example:
192-
/// - `#[inline]` becomes something similar to `#[attr="Inline(Hint)"]`.
193-
///
194-
/// As an internal implementation detail subject to change, this debug-printing format
195-
/// is currently equivalent to the HIR pretty-printing of parsed attributes.
196190
pub attrs: Vec<String>,
197191
/// Information about the item’s deprecation, if present.
198192
pub deprecation: Option<Deprecation>,

tests/rustdoc-json/attrs/inline.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//@ is "$.index[?(@.name=='just_inline')].attrs" '["#[inline]"]'
2+
#[inline]
3+
pub fn just_inline() {}
4+
5+
//@ is "$.index[?(@.name=='inline_always')].attrs" '["#[inline(always)]"]'
6+
#[inline(always)]
7+
pub fn inline_always() {}
8+
9+
//@ is "$.index[?(@.name=='inline_never')].attrs" '["#[inline(never)]"]'
10+
#[inline(never)]
11+
pub fn inline_never() {}

0 commit comments

Comments
 (0)