Skip to content

rustdoc --output-format json command seems broken #25108

Closed
@GuillaumeGomez

Description

@GuillaumeGomez

I tried this command:

> rustdoc --output-format json src/sysinfo.rs

On this repo.

Result:

src/sysinfo.rs:13:1: 13:19 error: use of unstable library feature 'libc'
src/sysinfo.rs:13 extern crate libc;
                  ^~~~~~~~~~~~~~~~~~
src/sysinfo.rs:13:1: 13:19 help: add #![feature(libc)] to the crate attributes to enable
src/processus.rs:43:42: 43:47 error: use of unstable library feature 'libc'
src/processus.rs:43         unsafe { ::ffi::kill(self.pid as c_int, signal as c_int) == 0 }
                                                             ^~~~~
src/processus.rs:43:42: 43:47 help: add #![feature(libc)] to the crate attributes to enable
src/processus.rs:43:59: 43:64 error: use of unstable library feature 'libc'
src/processus.rs:43         unsafe { ::ffi::kill(self.pid as c_int, signal as c_int) == 0 }
                                                                              ^~~~~
src/processus.rs:43:59: 43:64 help: add #![feature(libc)] to the crate attributes to enable
src/system.rs:15:5: 15:41 error: use of unstable library feature 'libc'
src/system.rs:15 use libc::types::os::arch::posix01::stat;
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/system.rs:15:5: 15:41 help: add #![feature(libc)] to the crate attributes to enable
src/system.rs:16:5: 16:17 error: use of unstable library feature 'libc'
src/system.rs:16 use libc::c_char;
                     ^~~~~~~~~~~~
src/system.rs:16:5: 16:17 help: add #![feature(libc)] to the crate attributes to enable
src/system.rs:17:5: 17:39 error: use of unstable library feature 'libc'
src/system.rs:17 use libc::funcs::posix01::stat_::lstat;
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/system.rs:17:5: 17:39 help: add #![feature(libc)] to the crate attributes to enable
src/system.rs:279:35: 279:39 error: use of unstable library feature 'libc'
src/system.rs:279                     let mut buf : stat = unsafe { ::std::mem::uninitialized() };
                                                    ^~~~
src/system.rs:279:35: 279:39 help: add #![feature(libc)] to the crate attributes to enable
src/system.rs:280:90: 280:96 error: use of unstable library feature 'libc'
src/system.rs:280                     let res = unsafe { lstat(result.to_str().unwrap().as_ptr() as *const c_char, &mut buf as *mut stat) };
                                                                                                           ^~~~~~
src/system.rs:280:90: 280:96 help: add #![feature(libc)] to the crate attributes to enable
src/system.rs:280:115: 280:119 error: use of unstable library feature 'libc'
src/system.rs:280                     let res = unsafe { lstat(result.to_str().unwrap().as_ptr() as *const c_char, &mut buf as *mut stat) };
                                                                                                                                    ^~~~
src/system.rs:280:115: 280:119 help: add #![feature(libc)] to the crate attributes to enable
src/system.rs:280:40: 280:45 error: use of unstable library feature 'libc'
src/system.rs:280                     let res = unsafe { lstat(result.to_str().unwrap().as_ptr() as *const c_char, &mut buf as *mut stat) };
                                                         ^~~~~
src/system.rs:280:40: 280:45 help: add #![feature(libc)] to the crate attributes to enable
src/system.rs:282:40: 282:47 error: use of unstable library feature 'libc'
src/system.rs:282                     if res < 0 || (buf.st_mode  & S_IFMT) != S_IFLNK {
                                                         ^~~~~~~
src/system.rs:282:40: 282:47 help: add #![feature(libc)] to the crate attributes to enable
src/system.rs:282:51: 282:57 error: use of unstable library feature 'libc'
src/system.rs:282                     if res < 0 || (buf.st_mode  & S_IFMT) != S_IFLNK {
                                                                    ^~~~~~
src/system.rs:282:51: 282:57 help: add #![feature(libc)] to the crate attributes to enable
src/system.rs:282:62: 282:69 error: use of unstable library feature 'libc'
src/system.rs:282                     if res < 0 || (buf.st_mode  & S_IFMT) != S_IFLNK {
                                                                               ^~~~~~~
src/system.rs:282:62: 282:69 help: add #![feature(libc)] to the crate attributes to enable
src/ffi.rs:10:19: 10:24 error: use of unstable library feature 'libc'
src/ffi.rs:10   pub fn kill(pid: c_int, signal: c_int) -> c_int;
                                 ^~~~~
src/ffi.rs:10:19: 10:24 help: add #![feature(libc)] to the crate attributes to enable
src/ffi.rs:10:34: 10:39 error: use of unstable library feature 'libc'
src/ffi.rs:10   pub fn kill(pid: c_int, signal: c_int) -> c_int;
                                                ^~~~~
src/ffi.rs:10:34: 10:39 help: add #![feature(libc)] to the crate attributes to enable
src/ffi.rs:10:44: 10:49 error: use of unstable library feature 'libc'
src/ffi.rs:10   pub fn kill(pid: c_int, signal: c_int) -> c_int;
                                                          ^~~~~
src/ffi.rs:10:44: 10:49 help: add #![feature(libc)] to the crate attributes to enable
error: aborting due to 16 previous errors
thread '<unnamed>' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:192
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: "rustc failed"', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libcore/result.rs:729
thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: Any', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libcore/result.rs:729

So then I added the "missing" feature (that's weird by the way) and then I got:

> rustdoc --output-format json src/sysinfo.rs 
thread '<unnamed>' panicked at 'Rust generated JSON is invalid: SyntaxError(EOFWhileParsingObject, 1, 99690)', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustdoc/lib.rs:525
thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: Any', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libcore/result.rs:729

I guess rustdoc is broken somehow ? Here's my current rustdoc version:

> rustdoc --version
rustdoc 1.1.0-nightly (ce1150b9f 2015-05-04) (built 2015-05-04)

Metadata

Metadata

Assignees

No one assigned

    Labels

    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