-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #73183 - Manishearth:intra-doc-macro, r=GuillaumeGomez
Support proc macros in intra doc link resolution The feature was written pre-proc macro resolution, so it only supported the wacky MBE resolution rules. This adds support for proc macros as well. cc @GuillaumeGomez Fixes #73173
- Loading branch information
Showing
3 changed files
with
134 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// 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_derive(DeriveTrait)] | ||
pub fn trait_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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// aux-build:intra-link-proc-macro-macro.rs | ||
// build-aux-docs | ||
#![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 intra_link_proc_macro/struct.Foo.html | ||
// @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/trait.DeriveTrait.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], [DeriveTrait] | ||
pub struct Foo; | ||
|
||
// @has intra_link_proc_macro/struct.Bar.html | ||
// @has - '//a/@href' '../intra_link_proc_macro/derive.DeriveA.html' | ||
// @has - '//a/@href' '../intra_link_proc_macro/attr.attr_a.html' | ||
/// Link to [deriveA](derive@DeriveA) [attr](macro@attr_a) | ||
pub struct Bar; | ||
|
||
// this should not cause ambiguity errors | ||
pub trait DeriveTrait {} |