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 panics when dealing with associated types #18594

Closed
japaric opened this issue Nov 4, 2014 · 3 comments
Closed

rustdoc panics when dealing with associated types #18594

japaric opened this issue Nov 4, 2014 · 3 comments
Labels
A-associated-items Area: Associated items such as associated types and consts. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@japaric
Copy link
Member

japaric commented Nov 4, 2014

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

@tomjakubowski
Copy link
Contributor

cc me. I'll be looking at this later today. If anyone has suggestions for how associated types should be rendered in the docs I'd like to hear them!

@huonw huonw added A-associated-items Area: Associated items such as associated types and consts. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Nov 20, 2014
@alexcrichton
Copy link
Member

@tomjakubowski feel free to ping me about this, it sounds like the stdlib really wants this fixed so I can help out to fix it if you need

@tomjakubowski
Copy link
Contributor

Addressed by #19174

tomjakubowski added a commit to tomjakubowski/rust that referenced this issue Nov 21, 2014
@bors bors closed this as completed in de94f0a Nov 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-associated-items Area: Associated items such as associated types and consts. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants