Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7c0a65e

Browse files
Remove doc_cfg, doc_auto_cfg and doc_cfg_hide features
1 parent a03dbf8 commit 7c0a65e

40 files changed

+39
-182
lines changed

‎compiler/rustc_ast_passes/src/feature_gate.rs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
165165

166166
gate_doc!(
167167
"experimental" {
168-
cfg => doc_cfg
169-
cfg_hide => doc_cfg_hide
170168
masked => doc_masked
171169
notable_trait => doc_notable_trait
172170
}

‎compiler/rustc_feature/src/unstable.rs‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -462,12 +462,6 @@ declare_features! (
462462
(unstable, deprecated_suggestion, "1.61.0", Some(94785)),
463463
/// Allows deref patterns.
464464
(incomplete, deref_patterns, "1.79.0", Some(87121)),
465-
/// Tells rustdoc to automatically generate `#[doc(cfg(...))]`.
466-
(unstable, doc_auto_cfg, "1.58.0", Some(43781)),
467-
/// Allows `#[doc(cfg(...))]`.
468-
(unstable, doc_cfg, "1.21.0", Some(43781)),
469-
/// Allows `#[doc(cfg_hide(...))]`.
470-
(unstable, doc_cfg_hide, "1.57.0", Some(43781)),
471465
/// Allows `#[doc(masked)]`.
472466
(unstable, doc_masked, "1.21.0", Some(44027)),
473467
/// Allows `dyn* Trait` objects.

‎compiler/rustc_passes/src/check_attr.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,14 +1283,14 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
12831283
self.tcx.emit_node_span_lint(
12841284
INVALID_DOC_ATTRIBUTES,
12851285
hir_id,
1286-
meta.span,
1286+
item.span(),
12871287
errors::DocAutoCfgExpectsHideOrShow,
12881288
);
12891289
} else if item.meta_item_list().is_none() {
12901290
self.tcx.emit_node_span_lint(
12911291
INVALID_DOC_ATTRIBUTES,
12921292
hir_id,
1293-
meta.span,
1293+
item.span(),
12941294
errors::DocAutoCfgHideShowExpectsList { attr_name: attr_name.as_str() },
12951295
);
12961296
}

‎compiler/rustc_span/src/symbol.rs‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -824,9 +824,6 @@ symbols! {
824824
do_not_recommend,
825825
doc,
826826
doc_alias,
827-
doc_auto_cfg,
828-
doc_cfg,
829-
doc_cfg_hide,
830827
doc_keyword,
831828
doc_masked,
832829
doc_notable_trait,

‎library/alloc/src/lib.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@
204204
// tidy-alphabetical-end
205205
//
206206
// Rustdoc features:
207-
#![feature(doc_cfg)]
208-
#![feature(doc_cfg_hide)]
207+
#![cfg_attr(bootstrap,feature(doc_cfg))]
208+
#![cfg_attr(bootstrap,feature(doc_cfg_hide))]
209209
// Technically, this is a bug in rustdoc: rustdoc sees the documentation on `#[lang = slice_alloc]`
210210
// blocks is for `&[T]`, which also has documentation using this feature in `core`, and gets mad
211211
// that the feature-gate isn't enabled. Ideally, it wouldn't check for the feature gate for docs

‎library/core/src/lib.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@
172172
#![feature(const_trait_impl)]
173173
#![feature(decl_macro)]
174174
#![feature(deprecated_suggestion)]
175-
#![feature(doc_cfg)]
176-
#![feature(doc_cfg_hide)]
175+
#![cfg_attr(bootstrap,feature(doc_cfg))]
176+
#![cfg_attr(bootstrap,feature(doc_cfg_hide))]
177177
#![feature(doc_notable_trait)]
178178
#![feature(extern_types)]
179179
#![feature(f128)]

‎library/std/src/lib.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,8 @@
301301
#![feature(concat_idents)]
302302
#![feature(decl_macro)]
303303
#![feature(deprecated_suggestion)]
304-
#![feature(doc_cfg)]
305-
#![feature(doc_cfg_hide)]
304+
#![cfg_attr(bootstrap,feature(doc_cfg))]
305+
#![cfg_attr(bootstrap,feature(doc_cfg_hide))]
306306
#![feature(doc_masked)]
307307
#![feature(doc_notable_trait)]
308308
#![feature(dropck_eyepatch)]

‎src/librustdoc/clean/types.rs‎

Lines changed: 11 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,34 +1030,20 @@ impl Default for CfgInfo {
10301030
}
10311031
}
10321032

1033-
fn handle_auto_cfg_hide_show(
1034-
tcx: TyCtxt<'_>,
1035-
cfg_info: &mut CfgInfo,
1036-
sub_attr: &MetaItemInner,
1037-
is_show: bool,
1038-
) {
1033+
fn handle_auto_cfg_hide_show(cfg_info: &mut CfgInfo, sub_attr: &MetaItemInner, is_show: bool) {
10391034
if let MetaItemInner::MetaItem(item) = sub_attr
10401035
&& let MetaItemKind::List(items) = &item.kind
10411036
{
10421037
for item in items {
1043-
match Cfg::parse(item) {
1044-
Ok(cfg) => {
1045-
if is_show {
1046-
cfg_info.hidden_cfg.remove(&cfg);
1047-
} else {
1048-
cfg_info.hidden_cfg.insert(cfg);
1049-
}
1050-
}
1051-
Err(_) => {
1052-
tcx.sess
1053-
.dcx()
1054-
.struct_span_err(sub_attr.span(), "unexpected `auto_cfg` value")
1055-
.emit();
1038+
// Errors should already have been reported in `rustc_passes::check_attr`.
1039+
if let Ok(cfg) = Cfg::parse(item) {
1040+
if is_show {
1041+
cfg_info.hidden_cfg.remove(&cfg);
1042+
} else {
1043+
cfg_info.hidden_cfg.insert(cfg);
10561044
}
10571045
}
10581046
}
1059-
} else {
1060-
tcx.sess.dcx().struct_span_err(sub_attr.span(), "unexpected `auto_cfg` value kind").emit();
10611047
}
10621048
}
10631049

@@ -1143,14 +1129,7 @@ pub(crate) fn extract_cfg_from_attrs<'a, I: Iterator<Item = &'a hir::Attribute>
11431129
sym::doc if let Some(attrs) = attr.meta_item_list() => {
11441130
for attr in attrs.iter().filter(|attr| attr.has_name(sym::auto_cfg)) {
11451131
let MetaItemInner::MetaItem(attr) = attr else {
1146-
tcx.sess
1147-
.dcx()
1148-
.struct_span_err(
1149-
attr.span(),
1150-
"unexpected value in `auto_cfg` attribute",
1151-
)
1152-
.emit();
1153-
break 'main;
1132+
continue;
11541133
};
11551134
match &attr.kind {
11561135
MetaItemKind::Word => {
@@ -1175,14 +1154,6 @@ pub(crate) fn extract_cfg_from_attrs<'a, I: Iterator<Item = &'a hir::Attribute>
11751154
changed_auto_active_status = Some(attr.span);
11761155
}
11771156
cfg_info.doc_auto_cfg_active = value;
1178-
} else {
1179-
tcx.sess
1180-
.dcx()
1181-
.struct_span_err(
1182-
attr.span,
1183-
"unexpected value for `auto_cfg` attribute",
1184-
)
1185-
.emit();
11861157
}
11871158
}
11881159
MetaItemKind::List(sub_attrs) => {
@@ -1197,34 +1168,14 @@ pub(crate) fn extract_cfg_from_attrs<'a, I: Iterator<Item = &'a hir::Attribute>
11971168
// Whatever happens next, the feature is enabled again.
11981169
cfg_info.doc_auto_cfg_active = true;
11991170
for sub_attr in sub_attrs.iter() {
1200-
let Some(ident) = sub_attr.ident() else {
1201-
tcx.sess
1202-
.dcx()
1203-
.struct_span_err(
1204-
attr.span,
1205-
"unexpected value for `auto_cfg` attribute",
1206-
)
1207-
.emit();
1208-
continue;
1209-
};
1210-
if ident.name == sym::show || ident.name == sym::hide {
1171+
if let Some(ident) = sub_attr.ident()
1172+
&& (ident.name == sym::show || ident.name == sym::hide)
1173+
{
12111174
handle_auto_cfg_hide_show(
1212-
tcx,
12131175
cfg_info,
12141176
&sub_attr,
12151177
ident.name == sym::show,
12161178
);
1217-
} else {
1218-
tcx.sess
1219-
.dcx()
1220-
.struct_span_err(
1221-
attr.span,
1222-
format!(
1223-
"unknown value `{}` for `auto_cfg` attribute",
1224-
ident.name
1225-
),
1226-
)
1227-
.emit();
12281179
}
12291180
}
12301181
}

‎tests/rustdoc-gui/src/lib2/lib.rs‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
// ignore-tidy-linelength
22

3-
#![feature(doc_cfg)]
4-
#![feature(doc_auto_cfg)]
5-
63
pub mod another_folder;
74
pub mod another_mod;
85

‎tests/rustdoc-gui/src/test_docs/lib.rs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#![crate_name = "test_docs"]
66
#![allow(internal_features)]
77
#![feature(rustdoc_internals)]
8-
#![feature(doc_cfg)]
98
#![feature(associated_type_defaults)]
109

1110
/*!

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /