Skip to content

Commit

Permalink
Add missing tests from test/ui/rustdoc into test/rustdoc-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Aug 7, 2021
1 parent 2ac7443 commit 9a4c5fb
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/test/rustdoc-ui/cfg-rustdoc.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// check-pass

#[cfg(doc)]
pub struct Foo;

fn main() {
let f = Foo;
}
7 changes: 7 additions & 0 deletions src/test/rustdoc-ui/deny-invalid-doc-attrs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#![deny(invalid_doc_attributes)]
//~^ NOTE defined here
#![doc(x)]
//~^ ERROR unknown `doc` attribute `x`
//~| WARNING will become a hard error
//~| NOTE see issue #82730
fn main() {}
16 changes: 16 additions & 0 deletions src/test/rustdoc-ui/deny-invalid-doc-attrs.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
error: unknown `doc` attribute `x`
--> $DIR/deny-invalid-doc-attrs.rs:3:8
|
LL | #![doc(x)]
| ^
|
note: the lint level is defined here
--> $DIR/deny-invalid-doc-attrs.rs:1:9
|
LL | #![deny(invalid_doc_attributes)]
| ^^^^^^^^^^^^^^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>

error: aborting due to previous error

9 changes: 9 additions & 0 deletions src/test/rustdoc-ui/doc-inline-extern-crate.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#[doc(inline)]
//~^ ERROR conflicting
#[doc(no_inline)]
pub extern crate core;

// no warning
pub extern crate alloc;

fn main() {}
13 changes: 13 additions & 0 deletions src/test/rustdoc-ui/doc-inline-extern-crate.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
error: conflicting doc inlining attributes
--> $DIR/doc-inline-extern-crate.rs:1:7
|
LL | #[doc(inline)]
| ^^^^^^ this attribute...
LL |
LL | #[doc(no_inline)]
| ^^^^^^^^^ ...conflicts with this attribute
|
= help: remove one of the conflicting attributes

error: aborting due to previous error

20 changes: 20 additions & 0 deletions src/test/rustdoc-ui/doc_keyword.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#![crate_type = "lib"]
#![feature(doc_keyword)]

#![doc(keyword = "hello")] //~ ERROR

#[doc(keyword = "hell")] //~ ERROR
mod foo {
fn hell() {}
}

#[doc(keyword = "hall")] //~ ERROR
fn foo() {}


// Regression test for the ICE described in #83512.
trait Foo {
#[doc(keyword = "match")]
//~^ ERROR: `#[doc(keyword = "...")]` can only be used on modules
fn quux() {}
}
26 changes: 26 additions & 0 deletions src/test/rustdoc-ui/doc_keyword.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
error: `#[doc(keyword = "...")]` can only be used on empty modules
--> $DIR/doc_keyword.rs:6:7
|
LL | #[doc(keyword = "hell")]
| ^^^^^^^^^^^^^^^^

error: `#[doc(keyword = "...")]` can only be used on modules
--> $DIR/doc_keyword.rs:11:7
|
LL | #[doc(keyword = "hall")]
| ^^^^^^^^^^^^^^^^

error: `#[doc(keyword = "...")]` can only be used on modules
--> $DIR/doc_keyword.rs:17:11
|
LL | #[doc(keyword = "match")]
| ^^^^^^^^^^^^^^^^^

error: `#![doc(keyword = "...")]` isn't allowed as a crate-level attribute
--> $DIR/doc_keyword.rs:4:8
|
LL | #![doc(keyword = "hello")]
| ^^^^^^^^^^^^^^^^^

error: aborting due to 4 previous errors

1 change: 1 addition & 0 deletions src/test/rustdoc-ui/unterminated-doc-comment.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/*! //~ ERROR E0758
9 changes: 9 additions & 0 deletions src/test/rustdoc-ui/unterminated-doc-comment.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0758]: unterminated block doc-comment
--> $DIR/unterminated-doc-comment.rs:1:1
|
LL | /*!
| ^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0758`.

0 comments on commit 9a4c5fb

Please sign in to comment.