holmgr / cargo-sweep

A cargo subcommand for cleaning up unused build files generated by Cargo
MIT License
694 stars 31 forks source link

Get compilation error when installing by `cargo install cargo-sweep` #12

Closed XiangQingW closed 5 years ago

XiangQingW commented 5 years ago

I got some error when installing. Details as follow:

> rustc -V
rustc 1.29.0-nightly (54628c8ea 2018-07-30)
> cargo install cargo-sweep
......
error[E0658]: access to extern crates through prelude is experimental (see issue #44660)
  --> src/stamp.rs:24:24
   |
24 |         file.write_all(serde_json::to_string(&self)?.as_bytes())?;
   |                        ^^^^^^^^^^
   |
   = help: add #![feature(extern_prelude)] to the crate attributes to enable

error[E0658]: access to extern crates through prelude is experimental (see issue #44660)
  --> src/stamp.rs:36:36
   |
36 |         let timestamp: Timestamp = serde_json::from_str(&contents)?;
   |                                    ^^^^^^^^^^
   |
   = help: add #![feature(extern_prelude)] to the crate attributes to enable

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0658`.
holmgr commented 5 years ago

Ah, ok. This seems to be due to me using a syntax that was introduced in 1.30. Not really needed so I will change back to the old syntax this week. Thanks for the info :)

holmgr commented 5 years ago

So I hopefully have a fix on master now that should solve this. If you would like to use the tool before next release, you would either have to build cargo-sweep from source:

git clone git@github.com:holmgr/cargo-sweep.git
cd cargo-sweep
cargo install

Or installing the latest stable/unstable using rustup and cargo installing with that (hopefully the syntax below is correct):

cargo +stable install cargo-sweep
cargo +stable sweep ...

Closing this for now since it should be "fixed". If you still can't build you are free to just open this again :)