about summary refs log tree commit diff
path: root/src/librustc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-08-29 01:22:11 +0000
committerbors <bors@rust-lang.org>2019-08-29 01:22:11 +0000
commit347654324dde17135072d2d704a71209dd3c5ca3 (patch)
treebfeb815ae52b06b3fadd832ff4e1fac0bb27b649 /src/librustc
parent0414dfa0aa072b6e1153ae60f94de852c07bb803 (diff)
parent4c3e386bd7ee9020407cee4ba120eebfb6373549 (diff)
downloadrust-347654324dde17135072d2d704a71209dd3c5ca3.tar.gz
rust-347654324dde17135072d2d704a71209dd3c5ca3.zip
Auto merge of #62855 - Aaron1011:feature/rustdoc-reexport-final, r=petrochenkov
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](https://github.com/rust-lang/cargo/pull/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.
Diffstat (limited to 'src/librustc')
-rw-r--r--src/librustc/session/config.rs18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
index 8e3b910e0da..9ecdff25d26 100644
--- a/src/librustc/session/config.rs
+++ b/src/librustc/session/config.rs
@@ -1719,13 +1719,7 @@ pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> {
                              static, framework, or dylib (the default).",
             "[KIND=]NAME",
         ),
-        opt::multi_s(
-            "",
-            "crate-type",
-            "Comma separated list of types of crates
-                                    for the compiler to emit",
-            "[bin|lib|rlib|dylib|cdylib|staticlib|proc-macro]",
-        ),
+        make_crate_type_option(),
         opt::opt_s(
             "",
             "crate-name",
@@ -2506,6 +2500,16 @@ pub fn build_session_options_and_crate_config(
     )
 }
 
+pub fn make_crate_type_option() -> RustcOptGroup {
+    opt::multi_s(
+        "",
+        "crate-type",
+        "Comma separated list of types of crates
+                                for the compiler to emit",
+        "[bin|lib|rlib|dylib|cdylib|staticlib|proc-macro]",
+    )
+}
+
 pub fn parse_crate_types_from_list(list_list: Vec<String>) -> Result<Vec<CrateType>, String> {
     let mut crate_types: Vec<CrateType> = Vec::new();
     for unparsed_crate_type in &list_list {