-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Closed
Copy link
Labels
A-decl-macros-1-2Area: Declarative macros 1.2Area: Declarative macros 1.2A-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameArea: Intra-doc links, the ability to link to items in docs by nameI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.
Description
The following code builds successfully but causes a compiler panic when running cargo doc
:
src/lib.rs
extern crate proc_macro;
/// [function_name]
#[proc_macro_attribute]
pub fn function_name(_attr: proc_macro::TokenStream, item: proc_macro::TokenStream) -> proc_macro::TokenStream {
item
}
Cargo.toml
[package]
name = "causes-rustdoc-panic"
version = "0.1.0"
[lib]
proc-macro = true
Compiler error
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:355:21
Toolchain
rustc 1.31.0-nightly (4bd4e4130 2018-10-25) running on x86_64-unknown-linux-gnu
Changing function_name
to another name, either in the doc comment or the actual function name (but not both), causes cargo doc
to succeed with a warning that the link cannot be resolved, as expected.
Using a normal public function in a non-proc_macro library also does not cause a panic, e.g.
/// [function_name]
#[inline]
pub fn function_name(_attr: u8, item: u8) -> u8 {
item
}
Metadata
Metadata
Assignees
Labels
A-decl-macros-1-2Area: Declarative macros 1.2Area: Declarative macros 1.2A-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameArea: Intra-doc links, the ability to link to items in docs by nameI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.