Skip to content

Commit 9a4c5fb

Browse files
Add missing tests from test/ui/rustdoc into test/rustdoc-ui
1 parent 2ac7443 commit 9a4c5fb

9 files changed

+109
-0
lines changed

src/test/rustdoc-ui/cfg-rustdoc.rs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// check-pass
2+
3+
#[cfg(doc)]
4+
pub struct Foo;
5+
6+
fn main() {
7+
let f = Foo;
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#![deny(invalid_doc_attributes)]
2+
//~^ NOTE defined here
3+
#![doc(x)]
4+
//~^ ERROR unknown `doc` attribute `x`
5+
//~| WARNING will become a hard error
6+
//~| NOTE see issue #82730
7+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error: unknown `doc` attribute `x`
2+
--> $DIR/deny-invalid-doc-attrs.rs:3:8
3+
|
4+
LL | #![doc(x)]
5+
| ^
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/deny-invalid-doc-attrs.rs:1:9
9+
|
10+
LL | #![deny(invalid_doc_attributes)]
11+
| ^^^^^^^^^^^^^^^^^^^^^^
12+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
13+
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
14+
15+
error: aborting due to previous error
16+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#[doc(inline)]
2+
//~^ ERROR conflicting
3+
#[doc(no_inline)]
4+
pub extern crate core;
5+
6+
// no warning
7+
pub extern crate alloc;
8+
9+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
error: conflicting doc inlining attributes
2+
--> $DIR/doc-inline-extern-crate.rs:1:7
3+
|
4+
LL | #[doc(inline)]
5+
| ^^^^^^ this attribute...
6+
LL |
7+
LL | #[doc(no_inline)]
8+
| ^^^^^^^^^ ...conflicts with this attribute
9+
|
10+
= help: remove one of the conflicting attributes
11+
12+
error: aborting due to previous error
13+

src/test/rustdoc-ui/doc_keyword.rs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#![crate_type = "lib"]
2+
#![feature(doc_keyword)]
3+
4+
#![doc(keyword = "hello")] //~ ERROR
5+
6+
#[doc(keyword = "hell")] //~ ERROR
7+
mod foo {
8+
fn hell() {}
9+
}
10+
11+
#[doc(keyword = "hall")] //~ ERROR
12+
fn foo() {}
13+
14+
15+
// Regression test for the ICE described in #83512.
16+
trait Foo {
17+
#[doc(keyword = "match")]
18+
//~^ ERROR: `#[doc(keyword = "...")]` can only be used on modules
19+
fn quux() {}
20+
}
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
error: `#[doc(keyword = "...")]` can only be used on empty modules
2+
--> $DIR/doc_keyword.rs:6:7
3+
|
4+
LL | #[doc(keyword = "hell")]
5+
| ^^^^^^^^^^^^^^^^
6+
7+
error: `#[doc(keyword = "...")]` can only be used on modules
8+
--> $DIR/doc_keyword.rs:11:7
9+
|
10+
LL | #[doc(keyword = "hall")]
11+
| ^^^^^^^^^^^^^^^^
12+
13+
error: `#[doc(keyword = "...")]` can only be used on modules
14+
--> $DIR/doc_keyword.rs:17:11
15+
|
16+
LL | #[doc(keyword = "match")]
17+
| ^^^^^^^^^^^^^^^^^
18+
19+
error: `#![doc(keyword = "...")]` isn't allowed as a crate-level attribute
20+
--> $DIR/doc_keyword.rs:4:8
21+
|
22+
LL | #![doc(keyword = "hello")]
23+
| ^^^^^^^^^^^^^^^^^
24+
25+
error: aborting due to 4 previous errors
26+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/*! //~ ERROR E0758
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0758]: unterminated block doc-comment
2+
--> $DIR/unterminated-doc-comment.rs:1:1
3+
|
4+
LL | /*!
5+
| ^^^^^^^^^^^^^^^^^^^^
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0758`.

0 commit comments

Comments
 (0)