Skip to content

rustdoc panics when dealing with associated types #18594

Closed
@japaric

Description

@japaric

STR

// lib.rs
#![feature(associated_types)]

use std::num::Zero;

pub trait AdditiveIterator {
    type Output;

    fn sum(&mut self) -> <Self as AdditiveIterator>::Output;
}

impl<T, I> AdditiveIterator for I where
    T: Add<T, T> + Zero,
    I: Iterator<T>,
{
    type Output = T;

    fn sum(&mut self) -> T {
        self.fold(Zero::zero(), |s, x| x + s)
    }
}

Output

$ rustdoc lib.rs
task '<unnamed>' panicked at 'Unimplemented type TyQPath(QPath { for_type: Ty { id: 11, node: TyPath(Path { span: Span { lo: BytePos(135), hi: BytePos(139), expn_id: ExpnId(4294967295) }, global: false, segments: [PathSegment { identifier: "Self"(10)#0, lifetimes: [], types: OwnedSlice {{}} }] }, None, 12), span: Span { lo: BytePos(135), hi: BytePos(139), expn_id: ExpnId(4294967295) } }, trait_name: Path { span: Span { lo: BytePos(143), hi: BytePos(159), expn_id: ExpnId(4294967295) }, global: false, segments: [PathSegment { identifier: "AdditiveIterator"(65)#0, lifetimes: [], types: OwnedSlice {{}} }] }, item_name: "Output"(66)#0 })', /var/tmp/paludis/build/dev-lang-rust-scm/work/rust-scm/src/librustdoc/clean/mod.rs:1262
task '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: rustc failed', /var/tmp/paludis/build/dev-lang-rust-scm/work/rust-scm/src/libcore/result.rs:789

Version

rustc 0.13.0-dev (851799d09 2014-11-03 07:37:23 +0000)

We can't use associated types in the stdlib until this gets fixed. (I mean, the crate will build fine, but we won't have docs, and bors would fail during doc generation/doctests).

cc #17307 @alexcrichton

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-associated-itemsArea: Associated items (types, constants & functions)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