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.
This commit is contained in:
Aaron Hill
2019-07-20 16:34:41 -04:00
parent 478464570e
commit 1498608135
13 changed files with 95 additions and 56 deletions

View File

@@ -1,13 +1,13 @@
running 2 tests
test $DIR/failed-doctest-output.rs - OtherStruct (line 20) ... FAILED
test $DIR/failed-doctest-output.rs - SomeStruct (line 10) ... FAILED
test $DIR/failed-doctest-output.rs - OtherStruct (line 21) ... FAILED
test $DIR/failed-doctest-output.rs - SomeStruct (line 11) ... FAILED
failures:
---- $DIR/failed-doctest-output.rs - OtherStruct (line 20) stdout ----
---- $DIR/failed-doctest-output.rs - OtherStruct (line 21) stdout ----
error[E0425]: cannot find value `no` in this scope
--> $DIR/failed-doctest-output.rs:21:1
--> $DIR/failed-doctest-output.rs:22:1
|
3 | no
| ^^ not found in this scope
@@ -16,7 +16,7 @@ error: aborting due to previous error
For more information about this error, try `rustc --explain E0425`.
Couldn't compile the test.
---- $DIR/failed-doctest-output.rs - SomeStruct (line 10) stdout ----
---- $DIR/failed-doctest-output.rs - SomeStruct (line 11) stdout ----
Test executable failed (exit code 101).
stdout:
@@ -32,8 +32,8 @@ note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
failures:
$DIR/failed-doctest-output.rs - OtherStruct (line 20)
$DIR/failed-doctest-output.rs - SomeStruct (line 10)
$DIR/failed-doctest-output.rs - OtherStruct (line 21)
$DIR/failed-doctest-output.rs - SomeStruct (line 11)
test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out