-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve Rustdoc's handling of procedural macros
Fixes #58700 Fixes #58696 Fixes #49553 Fixes #52210 This commit removes the special rustdoc handling for proc macros, as we can now retrieve their span and attributes just like any other item. A new command-line option is added to rustdoc: `--crate-type`. This takes the same options as rustc's `--crate-type` option. However, all values other than `proc-macro` are treated the same. This allows Rustdoc to enable 'proc macro mode' when handling a proc macro crate. In compiletest, a new 'rustdoc-flags' option is added. This allows us to pass in the '--proc-macro-crate' flag in the absence of Cargo. I've opened [an additional PR to Cargo](rust-lang/cargo#7159) to support passing in this flag. These two PRS can be merged in any order - the Cargo changes will not take effect until the 'cargo' submodule is updated in this repository.
- Loading branch information
Showing
13 changed files
with
95 additions
and
56 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
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
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
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
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
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 |
---|---|---|
@@ -1,16 +1,17 @@ | ||
// aux-build:proc_macro.rs | ||
// build-aux-docs | ||
|
||
// FIXME: if/when proc-macros start exporting their doc attributes across crates, we can turn on | ||
// cross-crate inlining for them | ||
|
||
extern crate some_macros; | ||
|
||
// @has proc_macro/index.html | ||
// @has - '//a/@href' '../some_macros/macro.some_proc_macro.html' | ||
// @has - '//a/@href' '../some_macros/attr.some_proc_attr.html' | ||
// @has - '//a/@href' '../some_macros/derive.SomeDerive.html' | ||
// @!has proc_macro/macro.some_proc_macro.html | ||
// @!has proc_macro/attr.some_proc_attr.html | ||
// @!has proc_macro/derive.SomeDerive.html | ||
// @has - '//a/@href' 'macro.some_proc_macro.html' | ||
// @has - '//a/@href' 'attr.some_proc_attr.html' | ||
// @has - '//a/@href' 'derive.SomeDerive.html' | ||
// @has proc_macro/macro.some_proc_macro.html | ||
// @has proc_macro/attr.some_proc_attr.html | ||
// @has proc_macro/derive.SomeDerive.html | ||
pub use some_macros::{some_proc_macro, some_proc_attr, SomeDerive}; | ||
|
||
// @has proc_macro/macro.reexported_macro.html | ||
// @has - 'Doc comment from the original crate' | ||
pub use some_macros::reexported_macro; |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
// force-host | ||
// no-prefer-dynamic | ||
// compile-flags: --crate-type proc-macro | ||
|
||
#![crate_type = "proc-macro"] | ||
|
||
|