-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Compiler panics when documenting sub-crate with links to types of super-crate on latest nightly #54100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I removed the links in the latest commits so I can document on nightly. The latest commit that still contains the links is: Lythenas/rust-orgmode@b1c65e8 |
I experimented a little more and found the following: When I have a doc comment with one link everything works: /// ...
/// [`SharedBehavior`]
/// ...
Also when specifying the link target it works: /// ...
/// [`SharedBehavior`]
/// ...
/// [`SharedBehavior`]: ../rust_orgmode/types/trait.SharedBehavior.html
When there is more than one link in one doc comment the compiler panics: /// ...
/// [`SharedBehavior`]
/// [`HasAffiliatedKeywords`]
/// ...
Even when one of them has a link target: /// ...
/// [`SharedBehavior`]
/// [`HasAffiliatedKeywords`]
/// ...
/// [`SharedBehavior`]: ../rust_orgmode/types/trait.SharedBehavior.html
But it works when both links have a target: /// ...
/// [`SharedBehavior`]
/// [`HasAffiliatedKeywords`]
/// ...
/// [`SharedBehavior`]: ../rust_orgmode/types/trait.SharedBehavior.html
/// [`HasAffiliatedKeywords`]: ../rust_orgmode/types/trait.HasAffiliatedKeywords.html
Also this does not happen in the main crate only in the sub-crate. I followed the proc macro guide in the book and created a subfolder named "rust-orgmode-derive. And in the Cargo.toml of the main crate I added |
I just tried to document that commit you linked with |
With the above commit I still get the same error using |
I'm afraid i'm not seeing it. Is this the right commit? $ cargo +nightly-2019-01-23 rustdoc
Documenting rust-orgmode v0.1.0 (/home/misdreavus/clones/rust-orgmode)
error: macro attributes must be placed before `#[derive]`
--> src/types.rs:337:5
|
337 | #[shared_behavior]
| ^^^^^^^^^^^^^^^^^^
error: Compilation failed, aborting rustdoc
error: Could not document `rust-orgmode`.
Caused by:
process didn't exit successfully: `rustdoc --crate-name rust_orgmode src/lib.rs --color always -o /home/misdreavus/clones/rust-orgmode/target/doc -L dependency=/home/misdreavus/clones/rust-orgmode/target/debug/deps --extern chrono=/home/misdreavus/clones/rust-orgmode/target/debug/deps/libchrono-af84f74b14cc1ea4.rmeta --extern failure=/home/misdreavus/clones/rust-orgmode/target/debug/deps/libfailure-13c12b1584de9b63.rmeta --extern failure_derive=/home/misdreavus/clones/rust-orgmode/target/debug/deps/libfailure_derive-4ee6c3df09cefde1.so --extern itertools=/home/misdreavus/clones/rust-orgmode/target/debug/deps/libitertools-1eac39dcb8e2c9f2.rmeta --extern lazy_static=/home/misdreavus/clones/rust-orgmode/target/debug/deps/liblazy_static-41d603f7ffea7a88.rmeta --extern nom=/home/misdreavus/clones/rust-orgmode/target/debug/deps/libnom-77224f728ad9d909.rmeta --extern regex=/home/misdreavus/clones/rust-orgmode/target/debug/deps/libregex-b88256a3f94d06b2.rmeta --extern rust_orgmode_derive=/home/misdreavus/clones/rust-orgmode/target/debug/deps/librust_orgmode_derive-83a3597b783b8ae9.so` (exit code: 1)
$ rustc +nightly-2019-01-23 --version
rustc 1.33.0-nightly (4c2be9c97 2019-01-22)
$ git status
HEAD detached at b1c65e8
nothing to commit, working tree clean |
Aha! I looked again and it turns out i'm documenting the wrong crate. $ cargo +nightly-2019-01-23 rustdoc -p rust-orgmode-derive
Checking unicode-xid v0.1.0
Checking proc-macro2 v0.4.17
Checking quote v0.6.8
Checking syn v0.15.3
Documenting rust-orgmode-derive v0.1.0 (/home/misdreavus/clones/rust-orgmode/rust-orgmode-derive)
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:345:21
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.33.0-nightly (4c2be9c97 2019-01-22) running on x86_64-unknown-linux-gnu
error: Could not document `rust-orgmode-derive`.
Caused by:
process didn't exit successfully: `rustdoc --crate-name rust_orgmode_derive rust-orgmode-derive/src/lib.rs --color always -o /home/misdreavus/clones/rust-orgmode/target/doc -L dependency=/home/misdreavus/clones/rust-orgmode/target/debug/deps --extern proc_macro2=/home/misdreavus/clones/rust-orgmode/target/debug/deps/libproc_macro2-7d0cb2f69b5e6e7d.rmeta --extern quote=/home/misdreavus/clones/rust-orgmode/target/debug/deps/libquote-9877f9e0a5ea1a89.rmeta --extern syn=/home/misdreavus/clones/rust-orgmode/target/debug/deps/libsyn-97f0413104af47b5.rmeta` (exit code: 1) It looks like #57846 fixes this issue as well! |
Sorry I forgot to mention that you have to swap two lines to get it to compile. Because now you have to put attributes before derive, which was not the case when I wrote this. But thanks for fixing this 👍 |
When I run
cargo doc
on this repo (branch refactor-datatypes) I receive an internal compiler error.Everything works fine on stable (
cargo +stable doc
). Also everything works if I remove the links in the doc comments.Meta
rustc --version --verbose
:Backtrace:
The text was updated successfully, but these errors were encountered: