Skip to content

rustdoc panic when trying to build docs #50159

Closed
@Pauan

Description

@Pauan

When I tried to build docs for my signals library, I got a panic.

Here is the reduced test case:

pub trait IntoSignal {
    type Signal: Signal<Item = Self::Item>;
    type Item;
}

impl<A> IntoSignal for A where A: Signal {
    type Signal = Self;
    type Item = A::Item;
}

pub trait Signal {
    type Item;
}

pub struct Map<A, B> {
    signal: A,
    callback: B,
}

impl<A, B, C> Signal for Map<A, B>
    where A: Signal,
          B: FnMut(A::Item) -> C {
    type Item = C;
}

pub struct Flatten<A: Signal> where A::Item: IntoSignal {
    signal: Option<A>,
    inner: Option<<A::Item as IntoSignal>::Signal>,
}

impl<A> Signal for Flatten<A>
    where A: Signal,
          A::Item: IntoSignal {
    type Item = <<A as Signal>::Item as IntoSignal>::Item;
}

pub struct Switch<A, B, C>
    where A: Signal,
          B: IntoSignal,
          C: FnMut(A::Item) -> B {
    inner: Flatten<Map<A, C>>,
}

impl<A, B, C> Signal for Switch<A, B, C>
    where A: Signal,
          B: IntoSignal,
          C: FnMut(A::Item) -> B {
    type Item = <B::Signal as Signal>::Item;
}

With the above code, when I run cargo doc --release I get this panic:

thread '<unnamed>' panicked at 'Unable to fulfill trait DefId(2/0:887 ~ core[accb]::marker[0]::Send[0]) for 'Switch<A, B, C>': [FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<<B as IntoSignal>::Signal as std::marker::Send>)),depth=3),Unimplemented)]', librustdoc\clean\auto_trait.rs:401:17
stack backtrace:
   0: <std::collections::hash::map::DefaultHasher as core::fmt::Debug>::fmt
   1: std::stdsimd::arch::detect::os::check_for
   2: std::panicking::take_hook
   3: std::panicking::take_hook
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::begin_panic_fmt
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: <unknown>
  10: <unknown>
  11: <unknown>
  12: <unknown>
  13: <unknown>
  14: <unknown>
  15: <unknown>
  16: <unknown>
  17: <unknown>
  18: <unknown>
  19: <unknown>
  20: <unknown>
  21: <unknown>
  22: <unknown>
  23: <unknown>
  24: <unknown>
  25: <unknown>
  26: <unknown>
  27: <unknown>
  28: <unknown>
  29: _rust_maybe_catch_panic
  30: <unknown>
  31: <<std::sys_common::remutex::ReentrantMutex<T> as core::fmt::Debug>::fmt::LockedPlaceholder as core::fmt::Debug>::fmt
  32: std::sys::windows::thread::Thread::new
  33: BaseThreadInitThunk
  34: RtlUserThreadStart
error: Could not document `reduced-test`.

Caused by:
  process didn't exit successfully: `rustdoc --crate-name reduced_test src\lib.rs -o C:\Users\Pauan\Shared Folders\NixOS\reduced-test\target\doc -L dependency=C:\Users\Pauan\Shared Folders\NixOS\reduced-test\target\release\deps` (exit code: 101)

Meta

rustc 1.27.0-nightly (ac3c228 2018-04-18)
binary: rustc
commit-hash: ac3c228
commit-date: 2018-04-18
host: x86_64-pc-windows-msvc
release: 1.27.0-nightly
LLVM version: 6.0

Metadata

Metadata

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions