Apply first review round suggestions

This commit is contained in:
Guillaume Gomez 2025-09-22 13:58:02 +02:00
parent 77885fef2c
commit 653e1036ed
6 changed files with 10 additions and 19 deletions

View file

@ -101,6 +101,8 @@ declare_features! (
Some("never properly implemented; requires significant design work"), 127655),
/// Allows deriving traits as per `SmartPointer` specification
(removed, derive_smart_pointer, "1.84.0", Some(123430), Some("replaced by `CoercePointee`"), 131284),
/// Allows `#[doc(cfg_hide(...))]`.
(removed, doc_cfg_hide, "1.57.0", Some(43781), Some("merged into `doc_cfg`"), 138907),
/// Allows using `#[doc(keyword = "...")]`.
(removed, doc_keyword, "1.58.0", Some(51315),
Some("merged into `#![feature(rustdoc_internals)]`"), 90420),

View file

@ -144,7 +144,7 @@ passes_doc_cfg_hide_takes_list =
`#[doc(cfg_hide(...))]` takes a list of attributes
passes_doc_auto_cfg_expects_hide_or_show =
`only "hide" or "show" are allowed in "#[doc(auto_cfg(...))]"`
only `hide` or `show` are allowed in `#[doc(auto_cfg(...))]`
passes_doc_auto_cfg_hide_show_expects_list =
`#![doc(auto_cfg({$attr_name}(...)))]` expects a list of items
@ -153,7 +153,7 @@ passes_doc_auto_cfg_hide_show_unexpected_item =
`#![doc(auto_cfg({$attr_name}(...)))]` only accepts identifiers or key/value items
passes_doc_auto_cfg_wrong_literal =
`expected boolean for #[doc(auto_cfg = ...)]`
expected boolean for `#[doc(auto_cfg = ...)]`
passes_doc_expect_str =
doc {$attr_name} attribute expects a string: #[doc({$attr_name} = "a")]

View file

@ -878,6 +878,7 @@ symbols! {
doc_alias,
doc_auto_cfg,
doc_cfg,
doc_cfg_hide,
doc_keyword,
doc_masked,
doc_notable_trait,

View file

@ -33,19 +33,7 @@ struct CfgPropagator<'a, 'tcx> {
/// Returns true if the provided `token` is a `cfg` ident.
fn is_cfg_token(token: &TokenTree) -> bool {
// We only keep `doc(cfg)` items.
matches!(
token,
TokenTree::Token(
Token {
kind: TokenKind::Ident(
ident,
_,
),
..
},
_,
) if *ident == sym::cfg,
)
matches!(token, TokenTree::Token(Token { kind: TokenKind::Ident(sym::cfg, _,), .. }, _,),)
}
/// We only want to keep `#[cfg()]` and `#[doc(cfg())]` attributes so we rebuild a vec of

View file

@ -9,7 +9,7 @@ use rustc_hir::attrs::AttributeKind;
use rustc_hir::def::{DefKind, MacroKinds, Res};
use rustc_hir::def_id::{DefId, DefIdMap, LocalDefId, LocalDefIdSet};
use rustc_hir::intravisit::{Visitor, walk_body, walk_item};
use rustc_hir::{CRATE_HIR_ID, Node, find_attr};
use rustc_hir::{Node, find_attr};
use rustc_middle::hir::nested_filter;
use rustc_middle::ty::TyCtxt;
use rustc_span::Span;

View file

@ -1,4 +1,4 @@
error: `only "hide" or "show" are allowed in "#[doc(auto_cfg(...))]"`
error: only `hide` or `show` are allowed in `#[doc(auto_cfg(...))]`
--> $DIR/doc-cfg.rs:11:7
|
LL | #[doc(auto_cfg(42))]
@ -30,13 +30,13 @@ error: `#![doc(auto_cfg(hide(...)))]` only accepts identifiers or key/value item
LL | #[doc(auto_cfg(hide(foo::bar)))]
| ^^^^^^^^
error: `expected boolean for #[doc(auto_cfg = ...)]`
error: expected boolean for `#[doc(auto_cfg = ...)]`
--> $DIR/doc-cfg.rs:16:7
|
LL | #[doc(auto_cfg = 42)]
| ^^^^^^^^^^^^^
error: `expected boolean for #[doc(auto_cfg = ...)]`
error: expected boolean for `#[doc(auto_cfg = ...)]`
--> $DIR/doc-cfg.rs:17:7
|
LL | #[doc(auto_cfg = "a")]