Skip to content

rustdoc panics if target crate has compilation errors #19181

Closed
@japaric

Description

@japaric

Updated issue

STR

// err.rs
fn main() { 0 }

Output

$ rustc err.rs 2>/dev/null || echo compilation error as expected
compilation error as expected
$ rustdoc err.rs
err.rs:2:5: 2:6 error: mismatched types: expected `()`, found `_` (expected (), found integral variable)
err.rs:2     0
             ^
error: aborting due to previous error
task '<unnamed>' panicked at 'Box<Any>', /var/tmp/paludis/build/dev-lang-rust-scm/work/rust-scm/src/libsyntax/diagnostic.rs:142
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:743

Original issue: rustdoc panics with #![deny(missing_docs] and associated items

STR

#![deny(missing_docs)]
#![feature(associated_types)]

//! Crate

/// Trait
pub trait AsSlice {
    /// Item
    type Item;

    // Forgot to document the method
    fn as_slice(&self) -> &[<Self as AsSlice>::Item];
}

Output

ai.rs:12:5: 12:53 error: missing documentation for a type method
ai.rs:12     fn as_slice(&self) -> &[<Self as AsSlice>::Item];
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ai.rs:1:9: 1:21 note: lint level defined here
ai.rs:1 #![deny(missing_docs)]
                ^~~~~~~~~~~~
error: aborting due to previous error
task '<unnamed>' panicked at 'Box<Any>', /var/tmp/paludis/build/dev-lang-rust-scm/work/rust-scm/src/libsyntax/diagnostic.rs:142
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:743

Version

#19174 on top of c9f6d69

cc @tomjakubowski

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.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