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

+1-1
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

+1-1
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

+1-1
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

+3-3
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

+4-4
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

+8-2
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

+8-1
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

+11-1
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

+1
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

+1-1
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)

library/core/src/future/future.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use crate::task::{Context, Poll};
2525
///
2626
/// [`async`]: ../../std/keyword.async.html
2727
/// [`Waker`]: crate::task::Waker
28-
#[doc(notable_trait)]
28+
#[cfg_attr(not(bootstrap), doc(notable))]
2929
#[must_use = "futures do nothing unless you `.await` or poll them"]
3030
#[stable(feature = "futures_api", since = "1.36.0")]
3131
#[lang = "future_trait"]

library/core/src/iter/traits/iterator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ fn _assert_is_object_safe(_: &dyn Iterator<Item = ()>) {}
6868
label = "`{Self}` is not an iterator",
6969
message = "`{Self}` is not an iterator"
7070
)]
71-
#[doc(notable_trait)]
71+
#[cfg_attr(not(bootstrap), doc(notable))]
7272
#[rustc_diagnostic_item = "Iterator"]
7373
#[must_use = "iterators are lazy and do nothing unless consumed"]
7474
pub trait Iterator {

library/std/src/fs.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ fn buffer_capacity_required(mut file: &File) -> Option<usize> {
748748
}
749749

750750
#[stable(feature = "rust1", since = "1.0.0")]
751-
#[doc(notable_trait)]
751+
#[cfg_attr(not(bootstrap), doc(notable))]
752752
impl Read for &File {
753753
#[inline]
754754
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
@@ -785,7 +785,7 @@ impl Read for &File {
785785
}
786786
}
787787
#[stable(feature = "rust1", since = "1.0.0")]
788-
#[doc(notable_trait)]
788+
#[cfg_attr(not(bootstrap), doc(notable))]
789789
impl Write for &File {
790790
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
791791
self.inner.write(buf)
@@ -813,7 +813,7 @@ impl Seek for &File {
813813
}
814814

815815
#[stable(feature = "rust1", since = "1.0.0")]
816-
#[doc(notable_trait)]
816+
#[cfg_attr(not(bootstrap), doc(notable))]
817817
impl Read for File {
818818
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
819819
(&*self).read(buf)
@@ -836,7 +836,7 @@ impl Read for File {
836836
}
837837
}
838838
#[stable(feature = "rust1", since = "1.0.0")]
839-
#[doc(notable_trait)]
839+
#[cfg_attr(not(bootstrap), doc(notable))]
840840
impl Write for File {
841841
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
842842
(&*self).write(buf)
@@ -861,7 +861,7 @@ impl Seek for File {
861861
}
862862

863863
#[stable(feature = "io_traits_arc", since = "1.73.0")]
864-
#[doc(notable_trait)]
864+
#[cfg_attr(not(bootstrap), doc(notable))]
865865
impl Read for Arc<File> {
866866
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
867867
(&**self).read(buf)
@@ -884,7 +884,7 @@ impl Read for Arc<File> {
884884
}
885885
}
886886
#[stable(feature = "io_traits_arc", since = "1.73.0")]
887-
#[doc(notable_trait)]
887+
#[cfg_attr(not(bootstrap), doc(notable))]
888888
impl Write for Arc<File> {
889889
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
890890
(&**self).write(buf)

library/std/src/io/cursor.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ where
520520
}
521521

522522
#[stable(feature = "rust1", since = "1.0.0")]
523-
#[doc(notable_trait)]
523+
#[cfg_attr(not(bootstrap), doc(notable))]
524524
impl Write for Cursor<&mut [u8]> {
525525
#[inline]
526526
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
@@ -544,7 +544,7 @@ impl Write for Cursor<&mut [u8]> {
544544
}
545545

546546
#[stable(feature = "cursor_mut_vec", since = "1.25.0")]
547-
#[doc(notable_trait)]
547+
#[cfg_attr(not(bootstrap), doc(notable))]
548548
impl<A> Write for Cursor<&mut Vec<u8, A>>
549549
where
550550
A: Allocator,
@@ -569,7 +569,7 @@ where
569569
}
570570

571571
#[stable(feature = "rust1", since = "1.0.0")]
572-
#[doc(notable_trait)]
572+
#[cfg_attr(not(bootstrap), doc(notable))]
573573
impl<A> Write for Cursor<Vec<u8, A>>
574574
where
575575
A: Allocator,
@@ -594,7 +594,7 @@ where
594594
}
595595

596596
#[stable(feature = "cursor_box_slice", since = "1.5.0")]
597-
#[doc(notable_trait)]
597+
#[cfg_attr(not(bootstrap), doc(notable))]
598598
impl<A> Write for Cursor<Box<[u8], A>>
599599
where
600600
A: Allocator,
@@ -621,7 +621,7 @@ where
621621
}
622622

623623
#[stable(feature = "cursor_array", since = "1.61.0")]
624-
#[doc(notable_trait)]
624+
#[cfg_attr(not(bootstrap), doc(notable))]
625625
impl<const N: usize> Write for Cursor<[u8; N]> {
626626
#[inline]
627627
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {

library/std/src/io/stdio.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ impl fmt::Debug for Stdin {
418418
}
419419

420420
#[stable(feature = "rust1", since = "1.0.0")]
421-
#[doc(notable_trait)]
421+
#[cfg_attr(not(bootstrap), doc(notable))]
422422
impl Read for Stdin {
423423
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
424424
self.lock().read(buf)
@@ -453,7 +453,7 @@ impl StdinLock<'_> {
453453
}
454454

455455
#[stable(feature = "rust1", since = "1.0.0")]
456-
#[doc(notable_trait)]
456+
#[cfg_attr(not(bootstrap), doc(notable))]
457457
impl Read for StdinLock<'_> {
458458
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
459459
self.inner.read(buf)
@@ -679,7 +679,7 @@ impl fmt::Debug for Stdout {
679679
}
680680

681681
#[stable(feature = "rust1", since = "1.0.0")]
682-
#[doc(notable_trait)]
682+
#[cfg_attr(not(bootstrap), doc(notable))]
683683
impl Write for Stdout {
684684
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
685685
(&*self).write(buf)
@@ -706,7 +706,7 @@ impl Write for Stdout {
706706
}
707707

708708
#[stable(feature = "write_mt", since = "1.48.0")]
709-
#[doc(notable_trait)]
709+
#[cfg_attr(not(bootstrap), doc(notable))]
710710
impl Write for &Stdout {
711711
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
712712
self.lock().write(buf)
@@ -733,7 +733,7 @@ impl Write for &Stdout {
733733
}
734734

735735
#[stable(feature = "rust1", since = "1.0.0")]
736-
#[doc(notable_trait)]
736+
#[cfg_attr(not(bootstrap), doc(notable))]
737737
impl Write for StdoutLock<'_> {
738738
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
739739
self.inner.borrow_mut().write(buf)
@@ -902,7 +902,7 @@ impl fmt::Debug for Stderr {
902902
}
903903

904904
#[stable(feature = "rust1", since = "1.0.0")]
905-
#[doc(notable_trait)]
905+
#[cfg_attr(not(bootstrap), doc(notable))]
906906
impl Write for Stderr {
907907
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
908908
(&*self).write(buf)
@@ -929,7 +929,7 @@ impl Write for Stderr {
929929
}
930930

931931
#[stable(feature = "write_mt", since = "1.48.0")]
932-
#[doc(notable_trait)]
932+
#[cfg_attr(not(bootstrap), doc(notable))]
933933
impl Write for &Stderr {
934934
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
935935
self.lock().write(buf)
@@ -956,7 +956,7 @@ impl Write for &Stderr {
956956
}
957957

958958
#[stable(feature = "rust1", since = "1.0.0")]
959-
#[doc(notable_trait)]
959+
#[cfg_attr(not(bootstrap), doc(notable))]
960960
impl Write for StderrLock<'_> {
961961
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
962962
self.inner.borrow_mut().write(buf)

library/std/src/io/util.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub const fn empty() -> Empty {
5757
}
5858

5959
#[stable(feature = "rust1", since = "1.0.0")]
60-
#[doc(notable_trait)]
60+
#[cfg_attr(not(bootstrap), doc(notable))]
6161
impl Read for Empty {
6262
#[inline]
6363
fn read(&mut self, _buf: &mut [u8]) -> io::Result<usize> {
@@ -180,7 +180,7 @@ pub const fn repeat(byte: u8) -> Repeat {
180180
}
181181

182182
#[stable(feature = "rust1", since = "1.0.0")]
183-
#[doc(notable_trait)]
183+
#[cfg_attr(not(bootstrap), doc(notable))]
184184
impl Read for Repeat {
185185
#[inline]
186186
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
@@ -274,7 +274,7 @@ pub const fn sink() -> Sink {
274274
}
275275

276276
#[stable(feature = "rust1", since = "1.0.0")]
277-
#[doc(notable_trait)]
277+
#[cfg_attr(not(bootstrap), doc(notable))]
278278
impl Write for Sink {
279279
#[inline]
280280
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
@@ -299,7 +299,7 @@ impl Write for Sink {
299299
}
300300

301301
#[stable(feature = "write_mt", since = "1.48.0")]
302-
#[doc(notable_trait)]
302+
#[cfg_attr(not(bootstrap), doc(notable))]
303303
impl Write for &Sink {
304304
#[inline]
305305
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {

0 commit comments

Comments
 (0)