diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2021-10-07 16:24:53 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-07 16:24:53 +0200 |
| commit | e32328bdc5a749d4b7d35297c85337522a07bddf (patch) | |
| tree | 2df540b61011010c62665cb486e085b4e468bd59 /library/alloc/src | |
| parent | de0b4f9444f870bf500f4b5f5ceae0acedf85e4a (diff) | |
| parent | 09c76884bc6ba1957dc6d71d79b797de2cc40b2d (diff) | |
| download | rust-e32328bdc5a749d4b7d35297c85337522a07bddf.tar.gz rust-e32328bdc5a749d4b7d35297c85337522a07bddf.zip | |
Rollup merge of #89596 - GuillaumeGomez:implicit-doc-cfg, r=jyn514
Make cfg imply doc(cfg) This is a reopening of #79341, rebased and modified a bit (we made a lot of refactoring in rustdoc's types so they needed to be reflected in this PR as well): * `hidden_cfg` is now in the `Cache` instead of `DocContext` because `cfg` information isn't stored anymore on `clean::Attributes` type but instead computed on-demand, so we need this information in later parts of rustdoc. * I removed the `bool_to_options` feature (which makes the code a bit simpler to read for `SingleExt` trait implementation. * I updated the version for the feature. There is only one thing I couldn't figure out: [this comment](https://github.com/rust-lang/rust/pull/79341#discussion_r561855624) > I think I'll likely scrap the whole `SingleExt` extension trait as the diagnostics for 0 and >1 items should be different. How/why should they differ? EDIT: this part has been solved, the current code was fine, just needed a little simplification. cc `@Nemo157` r? `@jyn514` Original PR description: This is only active when the `doc_cfg` feature is active. The implicit cfg can be overridden via `#[doc(cfg(...))]`, so e.g. to hide a `#[cfg]` you can use something like: ```rust #[cfg(unix)] #[doc(cfg(all()))] pub struct Unix; ``` By adding `#![doc(cfg_hide(foobar))]` to the crate attributes the cfg `#[cfg(foobar)]` (and _only_ that _exact_ cfg) will not be implicitly treated as a `doc(cfg)` to render a message in the documentation.
Diffstat (limited to 'library/alloc/src')
| -rw-r--r-- | library/alloc/src/lib.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index ca41ce975e4..72fe84222de 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -67,6 +67,10 @@ issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/", test(no_crate_inject, attr(allow(unused_variables), deny(warnings))) )] +#![cfg_attr( + not(bootstrap), + doc(cfg_hide(not(test), not(any(test, bootstrap)), target_has_atomic = "ptr")) +)] #![no_std] #![needs_allocator] #![warn(deprecated_in_future)] @@ -146,6 +150,8 @@ #![feature(associated_type_bounds)] #![feature(slice_group_by)] #![feature(decl_macro)] +#![feature(doc_cfg)] +#![cfg_attr(not(bootstrap), feature(doc_cfg_hide))] // Allow testing this library #[cfg(test)] |
