Skip to content

Commit

Permalink
Add test for #![doc(test(...)] with literal parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
obeis committed May 29, 2023
1 parent 33eef82 commit 70bbcce
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_passes/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,11 @@ passes_doc_keyword_not_mod =
passes_doc_keyword_only_impl =
`#[doc(keyword = "...")]` should be used on impl blocks
passes_doc_test_literal = `#![doc(test(...)]` does not take a literal
passes_doc_test_takes_list =
`#[doc(test(...)]` takes a list of attributes
passes_doc_test_literal = `#![doc(test(...)]` does not take a literal
passes_doc_test_unknown =
unknown `doc(test)` attribute `{$path}`
Expand Down
7 changes: 7 additions & 0 deletions tests/ui/attributes/doc-test-literal.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#![deny(warnings)]

#![doc(test(""))]
//~^ ERROR `#![doc(test(...)]` does not take a literal
//~^^ WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!

fn main() {}
17 changes: 17 additions & 0 deletions tests/ui/attributes/doc-test-literal.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
error: `#![doc(test(...)]` does not take a literal
--> $DIR/doc-test-literal.rs:3:13
|
LL | #![doc(test(""))]
| ^^
|
= 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>
note: the lint level is defined here
--> $DIR/doc-test-literal.rs:1:9
|
LL | #![deny(warnings)]
| ^^^^^^^^
= note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(warnings)]`

error: aborting due to previous error

0 comments on commit 70bbcce

Please sign in to comment.