Skip to content

Doc alias checks: ensure only items appearing in search index can use it #74098

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Aug 19, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add more tests for doc alias
  • Loading branch information
GuillaumeGomez committed Aug 11, 2020
commit 23a2ba6e53cd5cd8c4cc2f75cc1e7d2ac20d9cbc
13 changes: 13 additions & 0 deletions src/test/rustdoc-ui/check-doc-alias-attr-location.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#![feature(doc_alias)]

pub struct Bar;
pub trait Foo {}

#[doc(alias = "foo")] //~ ERROR
extern {}

#[doc(alias = "bar")] //~ ERROR
impl Bar {}

#[doc(alias = "foobar")] //~ ERROR
impl Foo for Bar {}
20 changes: 20 additions & 0 deletions src/test/rustdoc-ui/check-doc-alias-attr-location.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
error: `#[doc(alias = "...")]` isn't allowed on extern block
--> $DIR/check-doc-alias-attr-location.rs:6:7
|
LL | #[doc(alias = "foo")]
| ^^^^^^^^^^^^^

error: `#[doc(alias = "...")]` isn't allowed on implementation block
--> $DIR/check-doc-alias-attr-location.rs:9:7
|
LL | #[doc(alias = "bar")]
| ^^^^^^^^^^^^^

error: `#[doc(alias = "...")]` isn't allowed on implementation block
--> $DIR/check-doc-alias-attr-location.rs:12:7
|
LL | #[doc(alias = "foobar")]
| ^^^^^^^^^^^^^^^^

error: aborting due to 3 previous errors