Skip to content

cargo doc fails for packages depending on nix #917

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
carado opened this issue Jun 28, 2018 · 4 comments
Closed

cargo doc fails for packages depending on nix #917

carado opened this issue Jun 28, 2018 · 4 comments

Comments

@carado
Copy link

carado commented Jun 28, 2018

Hi, I noticed that cargo doc fails when documenting a project that has nix in its dependencies (whether directly or indirectly), apparently because of "unused import" errors.
This happens with nix v0.11.0, with the latest rustup-provided nightly cargo (e2348c2db 2018-06-07).

Steps to reproduce:

$ mkdir tmp
$ cd tmp
$ cargo init
$ echo 'nix = ""' >> Cargo.toml
$ cargo doc
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling nix v0.11.0                                                        
 Documenting void v1.0.2
 Documenting cfg-if v0.1.4
    Checking bitflags v1.0.3
 Documenting libc v0.2.42
 Documenting bitflags v1.0.3

(bitflags, void, libc, and cfg-if document fine while emitting a few warnings, elided here for readability)

 Documenting nix v0.11.0
error: unused import: `Error`
 --> /home/carado/.cargo/registry/src/github.heygears.com-1ecc6299db9ec823/nix-0.11.0/src/errno.rs:5:6
  |
5 | use {Error, Result};
  |      ^^^^^
  |
note: lint level defined here
 --> /home/carado/.cargo/registry/src/github.heygears.com-1ecc6299db9ec823/nix-0.11.0/src/lib.rs:13:9
  |
13| #![deny(unused)]
  |         ^^^^^^
  = note: #[deny(unused_imports)] implied by #[deny(unused)]

error: unused import: `sys::utsname::uname`
 --> /home/carado/.cargo/registry/src/github.heygears.com-1ecc6299db9ec823/nix-0.11.0/src/features.rs:6:9
  |
6 |     use sys::utsname::uname;
  |         ^^^^^^^^^^^^^^^^^^^

error: unused import: `Error`
 --> /home/carado/.cargo/registry/src/github.heygears.com-1ecc6299db9ec823/nix-0.11.0/src/fcntl.rs:1:6
  |
1 | use {Error, Result, NixPath};
  |      ^^^^^

(and more "error: unused import" errors)

(full log available here)
Thanks for you time.

@asomers
Copy link
Member

asomers commented Jul 8, 2018

I cannot reproduce using rust 1.20.0, 1.28.0-nightly, or 1.27.0-beta.8. And the error messages don't make sense to me, because those imports are used. And the docs certainly build fine on docs.rs. Can you tell me more about your environment?

@carado
Copy link
Author

carado commented Jul 8, 2018

I'm using rustup 1.11.0 (as indicated by rustup -v), provided by my distro's package manager.
My distro is Void Linux with glibc on x86_64. Apart from that, I don't think there's anything weird about my setup ?

Here are the results of my trying with various versions of rust (installed and used with rustup toolchain install (name) ; rustup default (name) where (name) is stable/beta/nightly)
stable 1.27.0 (rustc: 3eda71b00 2018-06-19, cargo: 1e95190e5 2018-05-27) : the errors don't happen !
beta 1.28.0-beta.7 (rustc: aabb736b9 2018-07-05, cargo: f6719ff2b 2018-06-29) : the errors still happen
nightly 1.29.0-nightly (rustc: 9fd3d7899 2018-07-07, cargo: af9e40c26 2018-07-05) : the errors still happen
I took care to cargo clean between attempts.

I'm currently working around the problem my having a local clone of nix where the line #![deny(unused)] of main.rs is commented, and as expected I can cargo build fine that way.

@asomers
Copy link
Member

asomers commented Jul 9, 2018

Ok, I can reproduce it too, now that I've upgraded to rustc 1.29.0-nightly.

@asomers
Copy link
Member

asomers commented Jul 9, 2018

It's a Rust bug.
rust-lang/rust#51661

@asomers asomers closed this as completed Jul 9, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants