Skip to content

rustdoc fails finding external crates when using crate alias #21795

@frewsxcv

Description

@frewsxcv

Basic example:

Given a file meow.rs with the following contents:

extern crate "rustc-serialize" as foobar;

...executing the command:

rustdoc meow.rs

Results in:

meow.rs:1:1: 1:42 error: can't find crate for `foobar`
meow.rs:1 extern crate "rustc-serialize" as foobar;
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
thread '<unnamed>' panicked at 'Box<Any>', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/libsyntax/diagnostic.rs:151
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: "rustc failed"', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/libcore/result.rs:743
thread '<main>' panicked at 'called `Option::unwrap()` on a `None` value', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/libcore/option.rs:362

The issue is that it's looking for docs for the crate foobar (the alias) instead of the actual crate rustc-serialize.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions