Description
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.