Skip to content
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 ICEs when a dependency has duplicate generic bounds to functions returning tuples #57180

Closed
lqd opened this issue Dec 28, 2018 · 4 comments · Fixed by #63937
Closed
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@lqd
Copy link
Member

lqd commented Dec 28, 2018

Minimized from a failing rustc PR updating polonius, itself coming with a newer revision of datafrog.

There's a minimized reproduction here.
If you add this crate as a git dependency, and use it, like so:

use docfail::Leaper;

fn main() {
}

Rustdoc will crash while trying to build the doc for this dependent crate (note that it does not fail building docs in the docfail repo itself)

Crash details:

Documenting repro v0.1.0 (/Users/rrakic/Documents/rust/docfail)
thread '<unnamed>' panicked at 'assertion failed: output.is_none()', src/librustdoc/clean/simplify.rs:108:21
note: Run with `RUST_BACKTRACE=1` for 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.32.0-nightly (14997d56a 2018-12-05) running on x86_64-apple-darwin

error: Could not document `repro`.

The essence of the problem is the duplicate bounds on an impl inside the dependency:

pub trait Leaper {}

pub struct FilterAnti<Func>
{
    phantom: ::std::marker::PhantomData<Func>,
}

impl<Func: Fn() -> (u32)>
    Leaper for FilterAnti<Func>
where
    Func: Fn() -> (u32),
{
}

Removing either of the duplicate Fn(...) bound will work around the crash. The bound requires that the closure return a tuple, and the rustdoc trace seems to be code related to parentheses.

I can reproduce the crash on stable 1.31.0 (abe02cefd 2018-12-04), 1.31.1 (b6c32da9b 2018-12-18), an older nightly from the beginning of December (14997d56a 2018-12-05), but haven't bisected older releases.

I couldn't find other issues mentioning this, and the error only appeared in the aforementioned rust PR.

Thanks to @Mark-Simulacrum for the help in locating this quite uncommon issue.

lqd added a commit to lqd/datafrog that referenced this issue Dec 28, 2018
This will work around rust-lang/rust#57180 (which prevents docs from building if they depend on datafrog). Thankfully they were not needed.
@estebank estebank added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Dec 29, 2018
@jonas-schievink jonas-schievink added the C-bug Category: This is a bug. label Aug 6, 2019
@Nashenas88
Copy link
Contributor

I'll try to take this on later tonight.

@Nashenas88
Copy link
Contributor

Nashenas88 commented Aug 30, 2019

I tracked this bug down to this commit: 6aa7493 It's not clear to me exactly why this commit would cause that issue. Any idea @QuietMisdreavus ?

@Nashenas88
Copy link
Contributor

Nashenas88 commented Aug 30, 2019

Stems from this PR #53162

@Nashenas88
Copy link
Contributor

Nashenas88 commented Sep 10, 2019

After some more analysis today, I realize the above comment is not the cause of the issue. I was using cargo rustdoc in my bisect script. The above commit is what causes cargo rustdoc to start failing, but cargo doc was failing before this. I'll do some more bisect analysis to see if I can figure out when this really started.

I reran cargo-bisect-rustc with cargo doc and got the same result. Not sure why cargo doc was giving a different result from cargo rustdoc earlier.

Centril added a commit to Centril/rust that referenced this issue Sep 27, 2019
…meGomez

 Fix ICE in rustdoc when merging generic and where bounds of an Fn with an output

Fixes rust-lang#57180
bors added a commit that referenced this issue Sep 27, 2019
 Fix ICE in rustdoc when merging generic and where bounds of an Fn with an output

Fixes #57180
@bors bors closed this as completed in c015927 Sep 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants