Attribute documentation for used, expect, should_panic, cfg_attr, and path#158664
Attribute documentation for used, expect, should_panic, cfg_attr, and path#158664kantnero wants to merge 8 commits into
used, expect, should_panic, cfg_attr, and path#158664Conversation
|
r? @JohnTitor rustbot has assigned @JohnTitor. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
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. |
This comment has been minimized.
This comment has been minimized.
…h, and ignore Signed-off-by: Emmanuel Ugwu <emmanuelugwu121@gmail.com>
…h, and ignore Signed-off-by: Emmanuel Ugwu <emmanuelugwu121@gmail.com>
Signed-off-by: Emmanuel Ugwu <emmanuelugwu121@gmail.com>
| /// 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. |
There was a problem hiding this comment.
| /// configuration predicate is true. If the condition is false, the attributes are ignored. |
| /// | ||
| /// ```rust | ||
| /// // This function is annotated with `#[test]` only when testing is active. | ||
| /// #[cfg_attr(test, test)] |
There was a problem hiding this comment.
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.
| /// } | ||
| /// ``` | ||
| /// | ||
| /// The predicate uses the same syntax as [`cfg`]. For complex conditions, you can combine |
There was a problem hiding this comment.
Does it link to the right cfg page?
| // | ||
| /// 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. |
There was a problem hiding this comment.
| /// annotated with the test attribute. | |
| /// annotated with the `test` attribute. |
Signed-off-by: Emmanuel Ugwu <emmanuelugwu121@gmail.com>
This comment has been minimized.
This comment has been minimized.
|
@rustbot ready |
|
CI fails so I don't think so. |
Signed-off-by: Emmanuel Ugwu <emmanuelugwu121@gmail.com>
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Emmanuel Ugwu <emmanuelugwu121@gmail.com>
Signed-off-by: Emmanuel Ugwu <emmanuelugwu121@gmail.com>
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Emmanuel Ugwu <emmanuelugwu121@gmail.com>
|
The job Click to see the possible cause of the failure (guessed by this bot) |
View all comments
Attribute documentation for
used,expect,should_panic,cfg_attr, andpathusing the#[doc(attribute = "")]mechanismTested with: ./x test library/std --doc
r? @GuillaumeGomez
cc @traviscross @fmease