Skip to content

Commit 3ef8d2d

Browse files
Update tests for rustc_doc_primitive
1 parent f40aa59 commit 3ef8d2d

29 files changed

+57
-56
lines changed

tests/rustdoc-json/impls/local_for_local_primitive.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![feature(no_core)]
2-
#![feature(rustdoc_internals)]
2+
#![feature(rustc_attrs)]
33
#![no_core]
44

55
// @set Local = "$.index[*][?(@.name=='Local')].id"
@@ -16,6 +16,6 @@ impl Local for bool {}
1616

1717
// FIXME(#101695): Test bool's `impls` include "Local for bool"
1818
// @has "$.index[*][?(@.name=='bool')]"
19-
#[doc(primitive = "bool")]
19+
#[rustc_doc_primitive = "bool"]
2020
/// Boolean docs
2121
mod prim_bool {}

tests/rustdoc-json/primitives/local_primitive.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
//! Link to [i32][prim@i32] [i64][prim@i64]
1010
11-
#[doc(primitive = "i32")]
11+
#[rustc_doc_primitive = "i32"]
1212
mod prim_i32 {}
1313

1414
// @set local_i32 = "$.index[*][?(@.name=='i32')].id"

tests/rustdoc-json/primitives/primitive_impls.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub trait Trait {}
2525
impl Trait for i32 {}
2626

2727
/// i32
28-
#[doc(primitive = "i32")]
28+
#[rustc_doc_primitive = "i32"]
2929
mod prim_i32 {}
3030

3131
// @set i32 = "$.index[*][?(@.docs=='i32')].id"

tests/rustdoc-json/primitives/primitive_overloading.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
// Regression test for <https://github.com/rust-lang/rust/issues/98006>.
44

5-
#![feature(rustdoc_internals)]
5+
#![feature(rustc_attrs)]
66
#![feature(no_core)]
77

88
#![no_core]
99

1010
// @has "$.index[*][?(@.name=='usize')]"
1111
// @has "$.index[*][?(@.name=='prim')]"
1212

13-
#[doc(primitive = "usize")]
13+
#[rustc_doc_primitive = "usize"]
1414
/// This is the built-in type `usize`.
1515
mod prim {
1616
}

tests/rustdoc-json/primitives/use_primitive.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// edition:2018
22

3-
#![feature(rustdoc_internals)]
3+
#![feature(rustc_attrs)]
44

5-
#[doc(primitive = "usize")]
5+
#[rustc_doc_primitive = "usize"]
66
mod usize {}
77

88
// @set local_crate_id = "$.index[*][?(@.name=='use_primitive')].crate_id"

tests/rustdoc-ui/coverage/exotic.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
// check-pass
33

44
#![feature(rustdoc_internals)]
5+
#![feature(rustc_attrs)]
56

67
//! the features only used in std also have entries in the table, so make sure those get pulled out
78
//! properly as well
89
910
/// woo, check it out, we can write our own primitive docs lol
10-
#[doc(primitive="unit")]
11+
#[rustc_doc_primitive = "unit"]
1112
mod prim_unit {}
1213

1314
/// keywords? sure, pile them on

tests/rustdoc/auto-impl-primitive.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
#![feature(rustdoc_internals)]
1+
#![feature(rustc_attrs)]
22

33
#![crate_name = "foo"]
44

55
pub use std::fs::File;
66

77
// @has 'foo/primitive.i16.html' '//h2[@id="synthetic-implementations"]' 'Auto Trait Implementation'
8-
#[doc(primitive = "i16")]
8+
#[rustc_doc_primitive = "i16"]
99
/// I love poneys!
1010
mod prim {}

tests/rustdoc/auxiliary/issue-15318.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// compile-flags: -Cmetadata=aux
33
#![crate_type = "rlib"]
44
#![doc(html_root_url = "http://example.com/")]
5+
#![feature(rustc_attrs)]
56
#![feature(lang_items)]
67
#![no_std]
78

@@ -12,5 +13,5 @@ fn foo() {}
1213
fn bar(_: &core::panic::PanicInfo) -> ! { loop {} }
1314

1415
/// dox
15-
#[doc(primitive = "pointer")]
16+
#[rustc_doc_primitive = "pointer"]
1617
pub mod ptr {}
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
// compile-flags: --crate-type lib --edition 2018
22

3+
#![feature(rustc_attrs)]
34
#![feature(no_core)]
45
#![no_core]
56

6-
#[doc(primitive = "usize")]
7+
#[rustc_doc_primitive = "usize"]
78
/// This is the built-in type `usize`.
89
mod usize {
910
}

tests/rustdoc/check-source-code-urls-to-def.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// aux-build:source_code.rs
33
// build-aux-docs
44

5-
#![feature(rustdoc_internals)]
5+
#![feature(rustc_attrs)]
66

77
#![crate_name = "foo"]
88

@@ -65,5 +65,5 @@ pub fn foo4() {
6565
}
6666

6767
// @has - '//pre[@class="rust"]//a[@href="../../foo/primitive.bool.html"]' 'bool'
68-
#[doc(primitive = "bool")]
68+
#[rustc_doc_primitive = "bool"]
6969
mod whatever {}

tests/rustdoc/intra-doc/auxiliary/my-core.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#![rustc_coherence_is_core]
44
#![crate_type="rlib"]
55

6-
#[doc(primitive = "char")]
6+
#[rustc_doc_primitive = "char"]
77
/// Some char docs
88
mod char {}
99

tests/rustdoc/intra-doc/no-doc-primitive.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Crate tree without a `doc(primitive)` module for primitive type linked to by a doc link.
1+
// Crate tree without a `rustc_doc_primitive` module for primitive type linked to by a doc link.
22

33
#![deny(rustdoc::broken_intra_doc_links)]
44
#![feature(no_core, lang_items, rustc_attrs)]

tests/rustdoc/intra-doc/prim-methods-local.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
//! A [prim@`char`] and its [`char::len_utf8`].
1212
13-
#[doc(primitive = "char")]
13+
#[rustc_doc_primitive = "char"]
1414
mod char {}
1515

1616
impl char {

tests/rustdoc/intra-doc/prim-self.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl usize {
2525
pub type ME = usize;
2626
}
2727

28-
#[doc(primitive = "usize")]
28+
#[rustc_doc_primitive = "usize"]
2929
/// This has some docs.
3030
mod usize {}
3131

tests/rustdoc/issue-15318-3.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
#![feature(rustdoc_internals)]
1+
#![feature(rustc_attrs)]
22

33
// @has issue_15318_3/primitive.pointer.html
44

55
/// dox
6-
#[doc(primitive = "pointer")]
6+
#[rustc_doc_primitive = "pointer"]
77
pub mod ptr {}

tests/rustdoc/issue-23511.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#![no_std]
44

55
pub mod str {
6-
#![doc(primitive = "str")]
6+
#![rustc_doc_primitive = "str"]
77

88
impl str {
99
// @hasraw search-index.js foo

tests/rustdoc/notable-trait/doc-notable_trait-mut_t_is_not_an_iterator.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
//!
77
//! [#80737]: https://github.com/rust-lang/rust/issues/80737
88
9-
#![feature(rustdoc_internals)]
9+
#![feature(rustc_attrs)]
1010
#![no_std]
1111

12-
#[doc(primitive = "reference")]
12+
#[rustc_doc_primitive = "reference"]
1313
/// Some useless docs, wouhou!
1414
///
1515
/// We need to put this in here, because notable traits

tests/rustdoc/notable-trait/doc-notable_trait-mut_t_is_not_ref_t.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
//!
66
//! [#78160]: https://github.com/rust-lang/rust/issues/78160
77
8-
#![feature(rustdoc_internals)]
8+
#![feature(rustc_attrs)]
99

10-
#[doc(primitive = "reference")]
10+
#[rustc_doc_primitive = "reference"]
1111
/// Some useless docs, wouhou!
1212
///
1313
/// We need to put this in here, because notable traits

tests/rustdoc/primitive-reference.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![crate_name = "foo"]
22

3-
#![feature(rustdoc_internals)]
3+
#![feature(rustc_attrs)]
44

55
// @has foo/index.html
66
// @has - '//h2[@id="primitives"]' 'Primitive Types'
@@ -16,7 +16,7 @@
1616
// @count - '//*[@class="impl"]' 1
1717
// @has - '//*[@id="impl-Foo%3C%26A%3E-for-%26B"]/*[@class="code-header"]' \
1818
// 'impl<A, B> Foo<&A> for &B'
19-
#[doc(primitive = "reference")]
19+
#[rustc_doc_primitive = "reference"]
2020
/// this is a test!
2121
mod reference {}
2222

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// compile-flags: --crate-type lib --edition 2018
22

33
#![crate_name = "foo"]
4-
#![feature(rustdoc_internals)]
4+
#![feature(rustc_attrs)]
55

66
// @has foo/primitive.slice.html '//a[@class="primitive"]' 'slice'
77
// @has - '//h1' 'Primitive Type slice'
88
// @has - '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!'
99
// @has - '//h2[@id="synthetic-implementations"]' 'Auto Trait Implementations'
1010
// @has - '//div[@id="synthetic-implementations-list"]//h3' 'impl<T> Send for [T]where T: Send'
1111
// @has - '//div[@id="synthetic-implementations-list"]//h3' 'impl<T> Sync for [T]where T: Sync'
12-
#[doc(primitive = "slice")]
12+
#[rustc_doc_primitive = "slice"]
1313
/// this is a test!
1414
mod slice_prim {}

tests/rustdoc/primitive-tuple-auto-trait.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// compile-flags: --crate-type lib --edition 2018
22

33
#![crate_name = "foo"]
4-
#![feature(rustdoc_internals)]
4+
#![feature(rustc_attrs)]
55

66
// @has foo/primitive.tuple.html '//a[@class="primitive"]' 'tuple'
77
// @has - '//h1' 'Primitive Type tuple'
88
// @has - '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!'
99
// @has - '//h2[@id="synthetic-implementations"]' 'Auto Trait Implementations'
1010
// @has - '//div[@id="synthetic-implementations-list"]//h3' 'Send'
1111
// @has - '//div[@id="synthetic-implementations-list"]//h3' 'Sync'
12-
#[doc(primitive = "tuple")]
12+
#[rustc_doc_primitive = "tuple"]
1313
/// this is a test!
1414
///
1515
// Hardcoded anchor to header written in library/core/src/primitive_docs.rs
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// compile-flags: --crate-type lib --edition 2018
22

33
#![crate_name = "foo"]
4-
#![feature(rustdoc_internals)]
4+
#![feature(rustc_attrs)]
55

66
// @has foo/primitive.unit.html '//a[@class="primitive"]' 'unit'
77
// @has - '//h1' 'Primitive Type unit'
88
// @has - '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!'
99
// @has - '//h2[@id="synthetic-implementations"]' 'Auto Trait Implementations'
1010
// @has - '//div[@id="synthetic-implementations-list"]//h3' 'impl Send for ()'
1111
// @has - '//div[@id="synthetic-implementations-list"]//h3' 'impl Sync for ()'
12-
#[doc(primitive = "unit")]
12+
#[rustc_doc_primitive = "unit"]
1313
/// this is a test!
1414
mod unit_prim {}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#![feature(rustdoc_internals)]
1+
#![feature(rustc_attrs)]
22
#![crate_name = "foo"]
33

44
// @has foo/primitive.i32.html '//*[@id="impl-ToString-for-i32"]//h3[@class="code-header"]' 'impl<T> ToString for T'
55

6-
#[doc(primitive = "i32")]
6+
#[rustc_doc_primitive = "i32"]
77
/// Some useless docs, wouhou!
88
mod i32 {}

tests/rustdoc/primitive/primitive.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![crate_name = "foo"]
22

3-
#![feature(rustdoc_internals)]
3+
#![feature(rustc_attrs)]
44

55
// @has foo/index.html '//h2[@id="primitives"]' 'Primitive Types'
66
// @has foo/index.html '//a[@href="primitive.i32.html"]' 'i32'
@@ -11,11 +11,11 @@
1111
// @has foo/primitive.i32.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!'
1212
// @has foo/index.html '//a/@href' '../foo/index.html'
1313
// @!has foo/index.html '//span' '🔒'
14-
#[doc(primitive = "i32")]
14+
#[rustc_doc_primitive = "i32"]
1515
/// this is a test!
1616
mod i32{}
1717

1818
// @has foo/primitive.bool.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'hello'
19-
#[doc(primitive = "bool")]
19+
#[rustc_doc_primitive = "bool"]
2020
/// hello
2121
mod bool {}

tests/rustdoc/sidebar-all-page.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![crate_name = "foo"]
22

3-
#![feature(rustdoc_internals)]
3+
#![feature(rustc_attrs)]
44

55
// @has 'foo/all.html'
66
// @has - '//*[@class="sidebar-elems"]//li' 'Structs'
@@ -31,5 +31,5 @@ macro_rules! foo {
3131
pub type Type = u8;
3232
pub const FOO: u8 = 0;
3333
pub static BAR: u8 = 0;
34-
#[doc(primitive = "u8")]
34+
#[rustc_doc_primitive = "u8"]
3535
mod u8 {}

tests/rustdoc/tab_title.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![crate_name = "foo"]
2+
#![feature(rustc_attrs)]
23
#![feature(rustdoc_internals)]
34

45
// tests for the html <title> element
@@ -39,6 +40,6 @@ mod continue_keyword {}
3940

4041
// @has foo/primitive.u8.html '//head/title' 'u8 - Rust'
4142
// @!has - '//head/title' 'foo'
42-
#[doc(primitive = "u8")]
43+
#[rustc_doc_primitive = "u8"]
4344
/// `u8` docs
4445
mod u8 {}

tests/rustdoc/titles.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![crate_name = "foo"]
2-
#![feature(rustdoc_internals)]
2+
#![feature(rustc_attrs)]
33

44
// @matches 'foo/index.html' '//h1' 'Crate foo'
55
// @matches 'foo/index.html' '//h2[@class="location"]' 'Crate foo'
@@ -41,7 +41,7 @@ macro_rules! foo_macro {
4141
}
4242

4343
// @matches 'foo/primitive.bool.html' '//h1' 'Primitive Type bool'
44-
#[doc(primitive = "bool")]
44+
#[rustc_doc_primitive = "bool"]
4545
mod bool {}
4646

4747
// @matches 'foo/static.FOO_STATIC.html' '//h1' 'Static foo::FOO_STATIC'

tests/ui/rustdoc/feature-gate-doc_primitive.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
// check-pass
2-
#[doc(primitive = "usize")]
3-
//~^ WARNING `doc(primitive)` should never have been stable
4-
//~| WARNING hard error in a future release
1+
#[rustc_doc_primitive = "usize"]
2+
//~^ ERROR `rustc_doc_primitive` is a rustc internal attribute
53
/// Some docs
64
mod usize {}
75

Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
warning: `doc(primitive)` should never have been stable
2-
--> $DIR/feature-gate-doc_primitive.rs:2:7
1+
error[E0658]: `rustc_doc_primitive` is a rustc internal attribute
2+
--> $DIR/feature-gate-doc_primitive.rs:1:1
33
|
4-
LL | #[doc(primitive = "usize")]
5-
| ^^^^^^^^^^^^^^^^^^^
4+
LL | #[rustc_doc_primitive = "usize"]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
7-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
8-
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
9-
= note: `#[warn(invalid_doc_attributes)]` on by default
7+
= help: add `#![feature(rustc_attrs)]` to the crate attributes to enable
108

11-
warning: 1 warning emitted
9+
error: aborting due to previous error
1210

11+
For more information about this error, try `rustc --explain E0658`.

0 commit comments

Comments
 (0)