Skip to content

Commit 70bbcce

Browse files
committed
Add test for #![doc(test(...)] with literal parameter
1 parent 33eef82 commit 70bbcce

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

compiler/rustc_passes/messages.ftl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,11 @@ passes_doc_keyword_not_mod =
211211
passes_doc_keyword_only_impl =
212212
`#[doc(keyword = "...")]` should be used on impl blocks
213213
214+
passes_doc_test_literal = `#![doc(test(...)]` does not take a literal
215+
214216
passes_doc_test_takes_list =
215217
`#[doc(test(...)]` takes a list of attributes
216218
217-
passes_doc_test_literal = `#![doc(test(...)]` does not take a literal
218-
219219
passes_doc_test_unknown =
220220
unknown `doc(test)` attribute `{$path}`
221221
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#![deny(warnings)]
2+
3+
#![doc(test(""))]
4+
//~^ ERROR `#![doc(test(...)]` does not take a literal
5+
//~^^ WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
6+
7+
fn main() {}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
error: `#![doc(test(...)]` does not take a literal
2+
--> $DIR/doc-test-literal.rs:3:13
3+
|
4+
LL | #![doc(test(""))]
5+
| ^^
6+
|
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: the lint level is defined here
10+
--> $DIR/doc-test-literal.rs:1:9
11+
|
12+
LL | #![deny(warnings)]
13+
| ^^^^^^^^
14+
= note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(warnings)]`
15+
16+
error: aborting due to previous error
17+

0 commit comments

Comments
 (0)