-
Notifications
You must be signed in to change notification settings - Fork 13.5k
rustdoc: Don't mark #[target_feature]
functions as ⚠
#142977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bors
merged 1 commit into
rust-lang:master
from
aDotInTheVoid:rustdochtml-targetfeature
Jun 25, 2025
+40
−1
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#![crate_name = "foo"] | ||
|
||
//@ has 'foo/index.html' | ||
|
||
//@ has - '//dl[@class="item-table"]/dt[1]//a' 'f1_safe' | ||
//@ has - '//dl[@class="item-table"]/dt[1]//code' 'popcnt' | ||
//@ count - '//dl[@class="item-table"]/dt[1]//sup' 0 | ||
//@ has - '//dl[@class="item-table"]/dt[2]//a' 'f2_not_safe' | ||
//@ has - '//dl[@class="item-table"]/dt[2]//code' 'avx2' | ||
//@ count - '//dl[@class="item-table"]/dt[2]//sup' 1 | ||
//@ has - '//dl[@class="item-table"]/dt[2]//sup' '⚠' | ||
|
||
#[target_feature(enable = "popcnt")] | ||
//@ has 'foo/fn.f1_safe.html' | ||
//@ matches - '//pre[@class="rust item-decl"]' '^pub fn f1_safe' | ||
//@ has - '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \ | ||
// 'Available with target feature popcnt only.' | ||
pub fn f1_safe() {} | ||
|
||
//@ has 'foo/fn.f2_not_safe.html' | ||
//@ matches - '//pre[@class="rust item-decl"]' '^pub unsafe fn f2_not_safe()' | ||
//@ has - '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \ | ||
// 'Available with target feature avx2 only.' | ||
#[target_feature(enable = "avx2")] | ||
pub unsafe fn f2_not_safe() {} | ||
|
||
//@ has 'foo/fn.f3_multifeatures_in_attr.html' | ||
//@ has - '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \ | ||
// 'Available on target features popcnt and avx2 only.' | ||
#[target_feature(enable = "popcnt", enable = "avx2")] | ||
pub fn f3_multifeatures_in_attr() {} | ||
|
||
//@ has 'foo/fn.f4_multi_attrs.html' | ||
//@ has - '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \ | ||
// 'Available on target features popcnt and avx2 only.' | ||
#[target_feature(enable = "popcnt")] | ||
#[target_feature(enable = "avx2")] | ||
pub fn f4_multi_attrs() {} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test needs to use
matches
instead ofhas
to catch check if there was a attribute printed before the function, e.g. to test for #142876 (comment)