Skip to content

Commit

Permalink
Add test for proc macro resolution in intra doc links
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Jun 9, 2020
1 parent 4eda3f7 commit e003c3e
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/test/rustdoc/auxiliary/intra-link-proc-macro-macro.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// force-host
// no-prefer-dynamic
// compile-flags: --crate-type proc-macro

#![crate_type="proc-macro"]
#![crate_name="intra_link_proc_macro_macro"]

extern crate proc_macro;

use proc_macro::TokenStream;

#[proc_macro_derive(DeriveA)]
pub fn a_derive(input: TokenStream) -> TokenStream {
input
}

#[proc_macro_derive(DeriveB)]
pub fn b_derive(input: TokenStream) -> TokenStream {
input
}

#[proc_macro_attribute]
pub fn attr_a(input: TokenStream, _args: TokenStream) -> TokenStream {
input
}

#[proc_macro_attribute]
pub fn attr_b(input: TokenStream, _args: TokenStream) -> TokenStream {
input
}
17 changes: 17 additions & 0 deletions src/test/rustdoc/intra-link-proc-macro.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// aux-build:intra-link-proc-macro-macro.rs
// build-aux-docs
// @has intra_link_proc_macro/index.html
#![deny(intra_doc_link_resolution_failure)]

extern crate intra_link_proc_macro_macro;


pub use intra_link_proc_macro_macro::{DeriveA, attr_a};
use intra_link_proc_macro_macro::{DeriveB, attr_b};

// @has - '//a/@href' '../intra_link_proc_macro/derive.DeriveA.html'
// @has - '//a/@href' '../intra_link_proc_macro/attr.attr_a.html'
// @has - '//a/@href' '../intra_link_proc_macro_macro/derive.DeriveB.html'
// @has - '//a/@href' '../intra_link_proc_macro_macro/attr.attr_b.html'
/// Link to [DeriveA], [attr_a], [DeriveB], [attr_b]
pub struct Foo;

0 comments on commit e003c3e

Please sign in to comment.