1
Fork 0

Rename #[doc(spotlight)] to #[doc(notable_trait)]

"spotlight" is not a very specific or self-explaining name.
Additionally, the dialog that it triggers is called "Notable traits".
So, "notable trait" is a better name.

* Rename `#[doc(spotlight)]` to `#[doc(notable_trait)]`
* Rename `#![feature(doc_spotlight)]` to `#![feature(doc_notable_trait)]`
* Update documentation
* Improve documentation
This commit is contained in:
Camelid 2021-03-08 19:35:53 -08:00
parent 2ccf06302c
commit 34c6cee397
23 changed files with 149 additions and 84 deletions

View file

@ -9,7 +9,7 @@ use rustc_middle::ty::query::Providers;
use rustc_middle::ty::TyCtxt;
use rustc_ast::{Attribute, Lit, LitKind, NestedMetaItem};
use rustc_errors::{pluralize, struct_span_err};
use rustc_errors::{pluralize, struct_span_err, Applicability};
use rustc_hir as hir;
use rustc_hir::def_id::LocalDefId;
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
@ -589,10 +589,10 @@ impl CheckAttrVisitor<'tcx> {
| sym::masked
| sym::no_default_passes
| sym::no_inline
| sym::notable_trait
| sym::passes
| sym::plugins
| sym::primitive
| sym::spotlight
| sym::test => {}
_ => {
@ -601,11 +601,23 @@ impl CheckAttrVisitor<'tcx> {
hir_id,
i_meta.span,
|lint| {
let msg = format!(
let mut diag = lint.build(&format!(
"unknown `doc` attribute `{}`",
rustc_ast_pretty::pprust::path_to_string(&i_meta.path),
);
lint.build(&msg).emit();
));
if i_meta.has_name(sym::spotlight) {
diag.note(
"`doc(spotlight)` was renamed to `doc(notable_trait)`",
);
diag.span_suggestion_short(
i_meta.span,
"use `notable_trait` instead",
String::from("notable_trait"),
Applicability::MachineApplicable,
);
diag.note("`doc(spotlight)` is now a no-op");
}
diag.emit();
},
);
is_valid = false;