Skip to content

Conversation

@folkertdev
Copy link
Contributor

Specifically, document that the detect macros expand to true when the feature is statically enabled.

Now that we have a bunch of these macros, perhaps we should streamline further how they are documented?

r? @Amanieu

@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 Oct 11, 2025
document that the detect macros expand to `true` when the feature is statically enabled
@folkertdev folkertdev force-pushed the std-detect-expands-to-true branch from 1a4a700 to bc911c2 Compare October 16, 2025 09:04
@rustbot
Copy link
Collaborator

rustbot commented Oct 16, 2025

This PR was rebased onto a different master 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.

Comment on lines 20 to 22
/// ## Supported arguments
///
/// * `"aes"` - FEAT_AES & FEAT_PMULL
Copy link
Contributor Author

Choose a reason for hiding this comment

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

does this list add anything? most of the information is in the doc comments on the individual features already. Only loongarch also has such a list, the other targets don't bother.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure, this list was originally added by @adamgemmell.

Copy link
Contributor

Choose a reason for hiding this comment

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

The mapping from feature names to proper hardware features is useful - I'd argue the doc comments on the individual features aren't actually needed as they don't show up in the rendered docs (https://doc.rust-lang.org/nightly/std/arch/macro.is_aarch64_feature_detected.html) - if I recall correctly they end up documenting a private struct. Both x86 and risc-v also provide a list of supported arguments (though the x86 ones don't list any extra information than is already available from how rustdoc renders the macro definition)

@Amanieu
Copy link
Member

Amanieu commented Nov 5, 2025

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Nov 5, 2025

📌 Commit bc911c2 has been approved by Amanieu

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 5, 2025
bors added a commit that referenced this pull request Nov 6, 2025
Rollup of 7 pull requests

Successful merges:

 - #145656 (Stabilize s390x `vector` target feature and `is_s390x_feature_detected!` macro)
 - #147043 (Add default sanitizers to TargetOptions)
 - #147803 (Add -Zannotate-moves for profiler visibility of move/copy operations (codegen))
 - #147912 ([rustdoc] Gracefully handle error in case we cannot run the compiler in doctests)
 - #148540 (Minor fixes to StdNonZeroNumberProvider for gdb)
 - #148541 (Add num_children method to some gdb pretty-printers)
 - #148549 (Fix broken qemu-cskyv2 link)

Failed merges:

 - #147586 (std-detect: improve detect macro docs)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Nov 6, 2025
Rollup of 7 pull requests

Successful merges:

 - #143037 (Make named asm_labels lint not trigger on hexagon register spans)
 - #147043 (Add default sanitizers to TargetOptions)
 - #147586 (std-detect: improve detect macro docs)
 - #147912 ([rustdoc] Gracefully handle error in case we cannot run the compiler in doctests)
 - #148540 (Minor fixes to StdNonZeroNumberProvider for gdb)
 - #148541 (Add num_children method to some gdb pretty-printers)
 - #148549 (Fix broken qemu-cskyv2 link)

Failed merges:

 - #147935 (Add LLVM realtime sanitizer)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit c9ca719 into rust-lang:master Nov 6, 2025
11 checks passed
@rustbot rustbot added this to the 1.93.0 milestone Nov 6, 2025
rust-timer added a commit that referenced this pull request Nov 6, 2025
Rollup merge of #147586 - folkertdev:std-detect-expands-to-true, r=Amanieu

std-detect: improve detect macro docs

Specifically, document that the detect macros expand to `true` when the feature is statically enabled.

Now that we have a bunch of these macros, perhaps we should streamline further how they are documented?

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

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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