Skip to content

Commit 24d3e9b

Browse files
committed
rename to doc(notable)
1 parent 8576693 commit 24d3e9b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+161
-102
lines changed

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
204204
cfg => doc_cfg
205205
cfg_hide => doc_cfg_hide
206206
masked => doc_masked
207-
notable_trait => doc_notable_trait
207+
notable => doc_notable_trait
208208
);
209209

210210
if nested_meta.has_name(sym::keyword) {

compiler/rustc_feature/src/removed.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ declare_features! (
8181
(removed, doc_primitive, "1.56.0", Some(88070), None,
8282
Some("merged into `#![feature(rustdoc_internals)]`")),
8383
/// Allows `#[doc(spotlight)]`.
84-
/// The attribute was renamed to `#[doc(notable_trait)]`
84+
/// The attribute was renamed to `#[doc(notable)]`
8585
/// and the feature to `doc_notable_trait`.
8686
(removed, doc_spotlight, "1.22.0", Some(45040), None,
8787
Some("renamed to `doc_notable_trait`")),

compiler/rustc_feature/src/unstable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ declare_features! (
231231
(unstable, auto_traits, "1.50.0", Some(13231), None),
232232
/// Allows using `box` in patterns (RFC 469).
233233
(unstable, box_patterns, "1.0.0", Some(29641), None),
234-
/// Allows `#[doc(notable_trait)]`.
234+
/// Allows `#[doc(notable)]`.
235235
/// Renamed from `doc_spotlight`.
236236
(unstable, doc_notable_trait, "1.52.0", Some(45040), None),
237237
/// Allows using the `may_dangle` attribute (RFC 1327).

compiler/rustc_middle/src/query/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,9 +1215,9 @@ rustc_queries! {
12151215
separate_provide_extern
12161216
}
12171217

1218-
/// Determines whether an item is annotated with `doc(notable_trait)`.
1219-
query is_doc_notable_trait(def_id: DefId) -> bool {
1220-
desc { |tcx| "checking whether `{}` is `doc(notable_trait)`", tcx.def_path_str(def_id) }
1218+
/// Determines whether an item is annotated with `doc(notable)`.
1219+
query is_doc_notable(def_id: DefId) -> bool {
1220+
desc { |tcx| "checking whether `{}` is `doc(notable)`", tcx.def_path_str(def_id) }
12211221
}
12221222

12231223
/// Returns the attributes on the item at `def_id`.

compiler/rustc_middle/src/ty/util.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,11 +1432,11 @@ fn is_doc_hidden(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
14321432
.any(|items| items.iter().any(|item| item.has_name(sym::hidden)))
14331433
}
14341434

1435-
/// Determines whether an item is annotated with `doc(notable_trait)`.
1436-
pub fn is_doc_notable_trait(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
1435+
/// Determines whether an item is annotated with `doc(notable)`.
1436+
pub fn is_doc_notable(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
14371437
tcx.get_attrs(def_id, sym::doc)
14381438
.filter_map(|attr| attr.meta_item_list())
1439-
.any(|items| items.iter().any(|item| item.has_name(sym::notable_trait)))
1439+
.any(|items| items.iter().any(|item| item.has_name(sym::notable)))
14401440
}
14411441

14421442
/// Determines whether an item is an intrinsic by Abi.
@@ -1448,7 +1448,7 @@ pub fn provide(providers: &mut Providers) {
14481448
*providers = Providers {
14491449
reveal_opaque_types_in_bounds,
14501450
is_doc_hidden,
1451-
is_doc_notable_trait,
1451+
is_doc_notable,
14521452
is_intrinsic,
14531453
..*providers
14541454
}

compiler/rustc_passes/messages.ftl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,16 @@ passes_doc_test_unknown_include =
252252
unknown `doc` attribute `{$path}`
253253
.suggestion = use `doc = include_str!` instead
254254
255+
passes_doc_test_unknown_notable_trait =
256+
unknown `doc` attribute `{$path}`
257+
.note = `doc(notable_trait)` was renamed to `doc(notable)`
258+
.suggestion = use `notable` instead
259+
.no_op_note = `doc(notable_trait)` is now a no-op
260+
255261
passes_doc_test_unknown_spotlight =
256262
unknown `doc` attribute `{$path}`
257-
.note = `doc(spotlight)` was renamed to `doc(notable_trait)`
258-
.suggestion = use `notable_trait` instead
263+
.note = `doc(spotlight)` was renamed to `doc(notable)`
264+
.suggestion = use `notable` instead
259265
.no_op_note = `doc(spotlight)` is now a no-op
260266
261267
passes_duplicate_diagnostic_item_in_crate =

compiler/rustc_passes/src/check_attr.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,7 @@ impl CheckAttrVisitor<'_> {
11571157
| sym::masked
11581158
| sym::no_default_passes
11591159
| sym::no_inline
1160-
| sym::notable_trait
1160+
| sym::notable
11611161
| sym::passes
11621162
| sym::plugins
11631163
| sym::fake_variadic => {}
@@ -1189,6 +1189,13 @@ impl CheckAttrVisitor<'_> {
11891189
i_meta.span,
11901190
errors::DocTestUnknownSpotlight { path, span: i_meta.span },
11911191
);
1192+
} else if i_meta.has_name(sym::notable_trait) {
1193+
self.tcx.emit_spanned_lint(
1194+
INVALID_DOC_ATTRIBUTES,
1195+
hir_id,
1196+
i_meta.span,
1197+
errors::DocTestUnknownNotableTrait { path, span: i_meta.span },
1198+
);
11921199
} else if i_meta.has_name(sym::include)
11931200
&& let Some(value) = i_meta.value_str()
11941201
{

compiler/rustc_passes/src/errors.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,13 +318,23 @@ pub struct DocTestUnknownAny {
318318
pub path: String,
319319
}
320320

321+
#[derive(LintDiagnostic)]
322+
#[diag(passes_doc_test_unknown_notable_trait)]
323+
#[note]
324+
#[note(passes_no_op_note)]
325+
pub struct DocTestUnknownNotableTrait {
326+
pub path: String,
327+
#[suggestion(style = "short", applicability = "machine-applicable", code = "notable")]
328+
pub span: Span,
329+
}
330+
321331
#[derive(LintDiagnostic)]
322332
#[diag(passes_doc_test_unknown_spotlight)]
323333
#[note]
324334
#[note(passes_no_op_note)]
325335
pub struct DocTestUnknownSpotlight {
326336
pub path: String,
327-
#[suggestion(style = "short", applicability = "machine-applicable", code = "notable_trait")]
337+
#[suggestion(style = "short", applicability = "machine-applicable", code = "notable")]
328338
pub span: Span,
329339
}
330340

compiler/rustc_span/src/symbol.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,6 +1097,7 @@ symbols! {
10971097
noreturn,
10981098
nostack,
10991099
not,
1100+
notable,
11001101
notable_trait,
11011102
note,
11021103
object_safe_for_dispatch,

library/core/src/fmt/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2260,7 +2260,7 @@ impl<'a> Formatter<'a> {
22602260
}
22612261

22622262
#[stable(since = "1.2.0", feature = "formatter_write")]
2263-
#[doc(notable_trait)]
2263+
#[cfg_attr(not(bootstrap), doc(notable))]
22642264
impl Write for Formatter<'_> {
22652265
fn write_str(&mut self, s: &str) -> Result {
22662266
self.buf.write_str(s)

0 commit comments

Comments
 (0)