Skip to content

Attribute documentation for used, expect, should_panic, cfg_attr, and path#158664

Open
kantnero wants to merge 8 commits into
rust-lang:mainfrom
kantnero:attribute-docs
Open

Attribute documentation for used, expect, should_panic, cfg_attr, and path#158664
kantnero wants to merge 8 commits into
rust-lang:mainfrom
kantnero:attribute-docs

Conversation

@kantnero

@kantnero kantnero commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

View all comments

Attribute documentation for used, expect, should_panic, cfg_attr, and path using the #[doc(attribute = "")] mechanism

Tested with: ./x test library/std --doc

r? @GuillaumeGomez
cc @traviscross @fmease

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 1, 2026
@rustbot

rustbot commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

r? @JohnTitor

rustbot has assigned @JohnTitor.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 13 candidates
  • Random selection from Darksonn, JohnTitor, Mark-Simulacrum, clarfonthey, jhpratt

@rustbot

rustbot commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rustbot

This comment has been minimized.

@rustbot rustbot added has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 1, 2026
kantnero added 2 commits July 1, 2026 16:59
…h, and ignore

Signed-off-by: Emmanuel Ugwu <emmanuelugwu121@gmail.com>
…h, and ignore

Signed-off-by: Emmanuel Ugwu <emmanuelugwu121@gmail.com>
Comment thread library/core/src/attribute_docs.rs Outdated
Comment thread library/core/src/attribute_docs.rs Outdated
Comment thread library/core/src/attribute_docs.rs Outdated
Comment thread library/core/src/attribute_docs.rs
Comment thread library/core/src/attribute_docs.rs Outdated
Comment thread library/core/src/attribute_docs.rs Outdated
Comment thread library/core/src/attribute_docs.rs Outdated
Comment thread library/core/src/attribute_docs.rs Outdated
Comment thread library/core/src/attribute_docs.rs Outdated
Signed-off-by: Emmanuel Ugwu <emmanuelugwu121@gmail.com>
@rustbot rustbot removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. has-merge-commits PR has merge commits, merge with caution. labels Jul 1, 2026
@kantnero kantnero requested a review from GuillaumeGomez July 1, 2026 16:43
@JohnTitor JohnTitor removed their assignment Jul 1, 2026
Comment thread library/core/src/attribute_docs.rs Outdated
/// Used for conditional application of attributes.
///
/// The `cfg_attr` attribute applies one or more attributes to an item only if a given
/// configuration predicate is true. If the condition is false, the attributes are ignored.

@GuillaumeGomez GuillaumeGomez Jul 2, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// configuration predicate is true. If the condition is false, the attributes are ignored.

View changes since the review

Comment thread library/core/src/attribute_docs.rs Outdated
///
/// ```rust
/// // This function is annotated with `#[test]` only when testing is active.
/// #[cfg_attr(test, test)]

@GuillaumeGomez GuillaumeGomez Jul 2, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's neat, but I think it's a bit too complex (test is present twice). I suggest instead to make it a test only on linux for example. Like that we have a clear predicate, completely different than the applied attribute.

View changes since the review

/// }
/// ```
///
/// The predicate uses the same syntax as [`cfg`]. For complex conditions, you can combine

@GuillaumeGomez GuillaumeGomez Jul 2, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it link to the right cfg page?

View changes since the review

Comment thread library/core/src/attribute_docs.rs Outdated
//
/// The `ignore` attribute is used with the `test` attribute to stop the test harness from
/// executing a function as a test. The `ignore` attribute may only be applied to functions
/// annotated with the test attribute.

@GuillaumeGomez GuillaumeGomez Jul 2, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// annotated with the test attribute.
/// annotated with the `test` attribute.

View changes since the review

Comment thread library/core/src/attribute_docs.rs Outdated
Comment thread library/core/src/attribute_docs.rs Outdated
Comment thread library/core/src/attribute_docs.rs
Comment thread library/core/src/attribute_docs.rs
Comment thread library/core/src/attribute_docs.rs
Comment thread library/core/src/attribute_docs.rs Outdated
Comment thread library/core/src/attribute_docs.rs Outdated
Comment thread library/core/src/attribute_docs.rs Outdated
Comment thread library/core/src/attribute_docs.rs Outdated
Comment thread library/core/src/attribute_docs.rs Outdated
Comment thread library/core/src/attribute_docs.rs
Comment thread library/core/src/attribute_docs.rs
Comment thread library/core/src/attribute_docs.rs Outdated
Comment thread library/core/src/attribute_docs.rs
Comment thread library/core/src/attribute_docs.rs Outdated
Signed-off-by: Emmanuel Ugwu <emmanuelugwu121@gmail.com>
@rust-log-analyzer

This comment has been minimized.

@kantnero kantnero requested a review from GuillaumeGomez July 2, 2026 18:36
@kantnero

kantnero commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@GuillaumeGomez

Copy link
Copy Markdown
Member

CI fails so I don't think so.

@GuillaumeGomez GuillaumeGomez added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 3, 2026
Signed-off-by: Emmanuel Ugwu <emmanuelugwu121@gmail.com>
@rust-log-analyzer

This comment has been minimized.

kantnero added 2 commits July 3, 2026 16:40
Signed-off-by: Emmanuel Ugwu <emmanuelugwu121@gmail.com>
Signed-off-by: Emmanuel Ugwu <emmanuelugwu121@gmail.com>
@rust-log-analyzer

This comment has been minimized.

Signed-off-by: Emmanuel Ugwu <emmanuelugwu121@gmail.com>
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants