diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs index fd6e631c2b5..ec2c703ad49 100644 --- a/compiler/rustc_feature/src/active.rs +++ b/compiler/rustc_feature/src/active.rs @@ -676,7 +676,7 @@ declare_features! ( (active, closure_track_caller, "1.57.0", Some(87417), None), /// Allows `#[doc(cfg_hide(...))]`. - (active, doc_cfg_hide, "1.53.0", Some(43781), None), + (active, doc_cfg_hide, "1.57.0", Some(43781), None), // ------------------------------------------------------------------------- // feature-group-end: actual feature gates diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index a9704bed2df..72fe84222de 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -65,9 +65,10 @@ #![doc( html_playground_url = "https://play.rust-lang.org/", issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/", - test(no_crate_inject, attr(allow(unused_variables), deny(warnings))), + test(no_crate_inject, attr(allow(unused_variables), deny(warnings))) )] -#![cfg_attr(not(bootstrap), +#![cfg_attr( + not(bootstrap), doc(cfg_hide(not(test), not(any(test, bootstrap)), target_has_atomic = "ptr")) )] #![no_std] diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index f4670d8feb2..630cf31634a 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -58,9 +58,10 @@ html_playground_url = "https://play.rust-lang.org/", issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/", test(no_crate_inject, attr(deny(warnings))), - test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))), + test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))) )] -#![cfg_attr(not(bootstrap), +#![cfg_attr( + not(bootstrap), doc(cfg_hide( not(test), target_pointer_width = "16", diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index af48e5e9bd2..e074609773a 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -193,11 +193,9 @@ html_playground_url = "https://play.rust-lang.org/", issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/", test(no_crate_inject, attr(deny(warnings))), - test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))), -)] -#![cfg_attr(not(bootstrap), - doc(cfg_hide(not(test), not(any(test, bootstrap)))) + test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))) )] +#![cfg_attr(not(bootstrap), doc(cfg_hide(not(test), not(any(test, bootstrap)))))] // Don't link to std. We are std. #![no_std] #![warn(deprecated_in_future)] diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index ebbf280d96d..09cb99dbf22 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -786,7 +786,9 @@ impl AttributesExt for [ast::Attribute] { fn single(self) -> Option { let mut iter = self.into_iter(); let item = iter.next()?; - iter.next().is_none().then_some(())?; + if iter.next().is_some() { + return None; + } Some(item) } } @@ -802,16 +804,19 @@ impl AttributesExt for [ast::Attribute] { if doc_cfg.peek().is_some() { doc_cfg .filter_map(|attr| { - Cfg::parse(&attr).map_err(|e| sess.diagnostic().span_err(e.span, e.msg)).ok() + Cfg::parse(&attr) + .map_err(|e| sess.diagnostic().span_err(e.span, e.msg)) + .ok() }) .fold(Cfg::True, |cfg, new_cfg| cfg & new_cfg) } else { - self - .iter() + self.iter() .filter(|attr| attr.has_name(sym::cfg)) .filter_map(|attr| Some(attr.meta_item_list()?.single()?.meta_item()?.clone())) .filter_map(|attr| { - Cfg::parse(&attr).map_err(|e| sess.diagnostic().span_err(e.span, e.msg)).ok() + Cfg::parse(&attr) + .map_err(|e| sess.diagnostic().span_err(e.span, e.msg)) + .ok() }) .filter(|cfg| !hidden_cfg.contains(cfg)) .fold(Cfg::True, |cfg, new_cfg| cfg & new_cfg) diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index d070ce22890..efc8e31498a 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -5,7 +5,6 @@ #![feature(rustc_private)] #![feature(array_methods)] #![feature(assert_matches)] -#![feature(bool_to_option)] #![feature(box_patterns)] #![feature(control_flow_enum)] #![feature(box_syntax)] diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index cd657fa01d4..36b1a14f6c1 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -3,10 +3,10 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_hir as hir; -use rustc_hir::CRATE_HIR_ID; use rustc_hir::def::{DefKind, Res}; use rustc_hir::def_id::DefId; use rustc_hir::Node; +use rustc_hir::CRATE_HIR_ID; use rustc_middle::middle::privacy::AccessLevel; use rustc_middle::ty::TyCtxt; use rustc_span; @@ -99,7 +99,11 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { } } - self.cx.cache.hidden_cfg = self.cx.tcx.hir().attrs(CRATE_HIR_ID) + self.cx.cache.hidden_cfg = self + .cx + .tcx + .hir() + .attrs(CRATE_HIR_ID) .iter() .filter(|attr| attr.has_name(sym::doc)) .flat_map(|attr| attr.meta_item_list().into_iter().flatten())