-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
rustdoc crashes on nightly nightly-2019-08-22 #63821
Comments
The source code is: #[derive::first]
#[derive::second]
pub enum Boom {
/// [Whatever]
Bam,
} with extern crate proc_macro;
#[proc_macro_attribute]
pub fn first(
_attr: proc_macro::TokenStream,
item: proc_macro::TokenStream,
) -> proc_macro::TokenStream {
item
}
#[proc_macro_attribute]
pub fn second(
_attr: proc_macro::TokenStream,
item: proc_macro::TokenStream,
) -> proc_macro::TokenStream {
// Note: if I return `item` as-is (same as `first` above), it resolves the issue!
let mut out: proc_macro::TokenStream = proc_macro::TokenStream::new();
out.extend(item);
out
} |
Couple of things that are important here:
|
Just a heads-up: AFAIK if a bug only occurs on stable with |
The bug itself reminds me of #46489. |
@nox it happens on nightly as well. That detail was included to give context that evidently the ICE has been present for longer than 12 weeks, I believe. |
With the following patch in the linked repo, diff --git a/src/librustdoc/passes/mod.rs b/src/librustdoc/passes/mod.rs
index 641a6df221..9970ac840f 100644
--- a/src/librustdoc/passes/mod.rs
+++ b/src/librustdoc/passes/mod.rs
@@ -409,7 +409,10 @@ crate fn source_span_for_markdown_range(
'outer: for (line_no, md_line) in md_lines.enumerate() {
loop {
- let source_line = src_lines.next().expect("could not find markdown in source");
+ let source_line = match src_lines.next() {
+ Some(line) => line,
+ None => break,
+ };
match source_line.find(md_line) {
Some(offset) => {
if line_no == starting_line { the output is not ideal, but preferable to the ICE: Documenting derive v0.1.0 (/Users/ekuber/workspace/rustdoc-crash/derive)
Documenting rustdoc-crash v0.1.0 (/Users/ekuber/workspace/rustdoc-crash)
warning: `[Whatever]` cannot be resolved, ignoring it...
--> src/lib.rs:1:2
|
1 | #[derive::first]
| ^^^^^^^^ cannot be resolved, ignoring
|
= note: `#[warn(intra_doc_link_resolution_failure)]` on by default
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]` I'll take a look to see if we can somehow keep the span for the entire attr doc, or at worst pointing at the correct |
Changing the patch to be diff --git a/src/librustdoc/passes/mod.rs b/src/librustdoc/passes/mod.rs
index 641a6df221..9970ac840f 100644
--- a/src/librustdoc/passes/mod.rs
+++ b/src/librustdoc/passes/mod.rs
@@ -409,7 +409,10 @@ crate fn source_span_for_markdown_range(
'outer: for (line_no, md_line) in md_lines.enumerate() {
loop {
- let source_line = src_lines.next().expect("could not find markdown in source");
+ let source_line = src_lines.next()?;
match source_line.find(md_line) {
Some(offset) => {
if line_no == starting_line { gives us warning: `[Whatever]` cannot be resolved, ignoring it...
|
= note: `#[warn(intra_doc_link_resolution_failure)]` on by default
= note: the link appears in this line:
[Whatever]
^^^^^^^^
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]` which makes more sense but is missing a primary span. Edit: I see no way to recover the original span after its |
Account for doc comments coming from proc macros without spans Fix rust-lang#63821.
Account for doc comments coming from proc macros without spans Fix rust-lang#63821.
Account for doc comments coming from proc macros without spans Fix rust-lang#63821.
cargo doc
crashes on nightly (nightly-2019-08-22
) and also on stable (1.37.0
) with "nightly" features turned on viaRUSTC_BOOSTRAP=1
. It does not trigger on stable withoutRUSTC_BOOTSTRAP=1
flag.Here is the output I'm getting:
I created a small repro case + README.md here: https://github.com/idubrov/rustdoc-crash (it only happens when there is a certain combination of procedural macros, so I cannot make it a single file).
The text was updated successfully, but these errors were encountered: