diff --git a/tests/rustdoc-ui/invalid-doc-attr.rs b/tests/rustdoc-ui/invalid-doc-attr.rs new file mode 100644 index 0000000000000..f92fa58c55b75 --- /dev/null +++ b/tests/rustdoc-ui/invalid-doc-attr.rs @@ -0,0 +1,19 @@ +// Ensures that invalid form of (some) doc attributes doesn't go unnoticed. + +#![deny(invalid_doc_attributes)] + +#[doc(hidden = "for some reason")] +//~^ ERROR didn't expect any arguments here +//~| WARN this was previously accepted by the compiler +#[doc(no_inline = "tada")] +//~^ ERROR didn't expect any arguments here +//~| WARN this was previously accepted by the compiler +pub fn foo() {} + +#[doc(hidden("for some reason"))] +//~^ ERROR didn't expect any arguments here +//~| WARN this was previously accepted by the compiler +#[doc(no_inline("tada"))] +//~^ ERROR didn't expect any arguments here +//~| WARN this was previously accepted by the compiler +pub fn foo2() {} diff --git a/tests/rustdoc-ui/invalid-doc-attr.stderr b/tests/rustdoc-ui/invalid-doc-attr.stderr new file mode 100644 index 0000000000000..80717df407eb6 --- /dev/null +++ b/tests/rustdoc-ui/invalid-doc-attr.stderr @@ -0,0 +1,39 @@ +error: didn't expect any arguments here + --> $DIR/invalid-doc-attr.rs:5:14 + | +LL | #[doc(hidden = "for some reason")] + | ^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +note: the lint level is defined here + --> $DIR/invalid-doc-attr.rs:3:9 + | +LL | #![deny(invalid_doc_attributes)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: didn't expect any arguments here + --> $DIR/invalid-doc-attr.rs:8:17 + | +LL | #[doc(no_inline = "tada")] + | ^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + +error: didn't expect any arguments here + --> $DIR/invalid-doc-attr.rs:13:13 + | +LL | #[doc(hidden("for some reason"))] + | ^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + +error: didn't expect any arguments here + --> $DIR/invalid-doc-attr.rs:16:16 + | +LL | #[doc(no_inline("tada"))] + | ^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + +error: aborting due to 4 previous errors +