Skip to content

Commit 653e103

Browse files
Apply first review round suggestions
1 parent 77885fe commit 653e103

File tree

6 files changed

+10
-19
lines changed

6 files changed

+10
-19
lines changed

compiler/rustc_feature/src/removed.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ declare_features! (
101101
Some("never properly implemented; requires significant design work"), 127655),
102102
/// Allows deriving traits as per `SmartPointer` specification
103103
(removed, derive_smart_pointer, "1.84.0", Some(123430), Some("replaced by `CoercePointee`"), 131284),
104+
/// Allows `#[doc(cfg_hide(...))]`.
105+
(removed, doc_cfg_hide, "1.57.0", Some(43781), Some("merged into `doc_cfg`"), 138907),
104106
/// Allows using `#[doc(keyword = "...")]`.
105107
(removed, doc_keyword, "1.58.0", Some(51315),
106108
Some("merged into `#![feature(rustdoc_internals)]`"), 90420),

compiler/rustc_passes/messages.ftl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ passes_doc_cfg_hide_takes_list =
144144
`#[doc(cfg_hide(...))]` takes a list of attributes
145145
146146
passes_doc_auto_cfg_expects_hide_or_show =
147-
`only "hide" or "show" are allowed in "#[doc(auto_cfg(...))]"`
147+
only `hide` or `show` are allowed in `#[doc(auto_cfg(...))]`
148148
149149
passes_doc_auto_cfg_hide_show_expects_list =
150150
`#![doc(auto_cfg({$attr_name}(...)))]` expects a list of items
@@ -153,7 +153,7 @@ passes_doc_auto_cfg_hide_show_unexpected_item =
153153
`#![doc(auto_cfg({$attr_name}(...)))]` only accepts identifiers or key/value items
154154
155155
passes_doc_auto_cfg_wrong_literal =
156-
`expected boolean for #[doc(auto_cfg = ...)]`
156+
expected boolean for `#[doc(auto_cfg = ...)]`
157157
158158
passes_doc_expect_str =
159159
doc {$attr_name} attribute expects a string: #[doc({$attr_name} = "a")]

compiler/rustc_span/src/symbol.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,7 @@ symbols! {
878878
doc_alias,
879879
doc_auto_cfg,
880880
doc_cfg,
881+
doc_cfg_hide,
881882
doc_keyword,
882883
doc_masked,
883884
doc_notable_trait,

src/librustdoc/passes/propagate_doc_cfg.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,7 @@ struct CfgPropagator<'a, 'tcx> {
3333
/// Returns true if the provided `token` is a `cfg` ident.
3434
fn is_cfg_token(token: &TokenTree) -> bool {
3535
// We only keep `doc(cfg)` items.
36-
matches!(
37-
token,
38-
TokenTree::Token(
39-
Token {
40-
kind: TokenKind::Ident(
41-
ident,
42-
_,
43-
),
44-
..
45-
},
46-
_,
47-
) if *ident == sym::cfg,
48-
)
36+
matches!(token, TokenTree::Token(Token { kind: TokenKind::Ident(sym::cfg, _,), .. }, _,),)
4937
}
5038

5139
/// We only want to keep `#[cfg()]` and `#[doc(cfg())]` attributes so we rebuild a vec of

src/librustdoc/visit_ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_hir::attrs::AttributeKind;
99
use rustc_hir::def::{DefKind, MacroKinds, Res};
1010
use rustc_hir::def_id::{DefId, DefIdMap, LocalDefId, LocalDefIdSet};
1111
use rustc_hir::intravisit::{Visitor, walk_body, walk_item};
12-
use rustc_hir::{CRATE_HIR_ID, Node, find_attr};
12+
use rustc_hir::{Node, find_attr};
1313
use rustc_middle::hir::nested_filter;
1414
use rustc_middle::ty::TyCtxt;
1515
use rustc_span::Span;

tests/rustdoc-ui/doc-cfg.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: `only "hide" or "show" are allowed in "#[doc(auto_cfg(...))]"`
1+
error: only `hide` or `show` are allowed in `#[doc(auto_cfg(...))]`
22
--> $DIR/doc-cfg.rs:11:7
33
|
44
LL | #[doc(auto_cfg(42))]
@@ -30,13 +30,13 @@ error: `#![doc(auto_cfg(hide(...)))]` only accepts identifiers or key/value item
3030
LL | #[doc(auto_cfg(hide(foo::bar)))]
3131
| ^^^^^^^^
3232

33-
error: `expected boolean for #[doc(auto_cfg = ...)]`
33+
error: expected boolean for `#[doc(auto_cfg = ...)]`
3434
--> $DIR/doc-cfg.rs:16:7
3535
|
3636
LL | #[doc(auto_cfg = 42)]
3737
| ^^^^^^^^^^^^^
3838

39-
error: `expected boolean for #[doc(auto_cfg = ...)]`
39+
error: expected boolean for `#[doc(auto_cfg = ...)]`
4040
--> $DIR/doc-cfg.rs:17:7
4141
|
4242
LL | #[doc(auto_cfg = "a")]

0 commit comments

Comments
 (0)