Skip to content

Commit

Permalink
Add test for doc alias attribute validation
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed May 30, 2020
1 parent b97487b commit 2d6267a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/test/rustdoc-ui/check-doc-alias-attr.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#![feature(doc_alias)]

#[doc(alias = "foo")] // ok!
pub struct Bar;

#[doc(alias)] //~ ERROR
#[doc(alias = 0)] //~ ERROR
#[doc(alias("bar"))] //~ ERROR
pub struct Foo;
20 changes: 20 additions & 0 deletions src/test/rustdoc-ui/check-doc-alias-attr.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
error: doc alias attribute expects a string: #[doc(alias = "0")]
--> $DIR/check-doc-alias-attr.rs:6:7
|
LL | #[doc(alias)]
| ^^^^^

error: doc alias attribute expects a string: #[doc(alias = "0")]
--> $DIR/check-doc-alias-attr.rs:7:7
|
LL | #[doc(alias = 0)]
| ^^^^^^^^^

error: doc alias attribute expects a string: #[doc(alias = "0")]
--> $DIR/check-doc-alias-attr.rs:8:7
|
LL | #[doc(alias("bar"))]
| ^^^^^^^^^^^^

error: aborting due to 3 previous errors

0 comments on commit 2d6267a

Please sign in to comment.