Skip to content

Multiple unused pub reexports on one line cannot be automatically fixed #52797

New issue

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

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

Already on GitHub? Sign in to your account

Closed
nwoeanhinnogaehr opened this issue Jul 28, 2018 · 2 comments
Closed
Labels
A-edition-2018 Area: The 2018 edition A-lints Area: Lints (warnings about flaws in source code) such as unused_mut.

Comments

@nwoeanhinnogaehr
Copy link

cargo fix is unable to deal with this:

#![feature(rust_2018_preview)]
#![warn(rust_2018_idioms)]

mod foo {
    pub use std::{io, fs};
}
fn main() { }

I thought it was a problem with cargo not handling the multiple unused items, but @alexcrichton said it should be fixed at the lint level. It produces this output:

warning: error applying suggestions to `src/main.rs`

The full error message was:

> Cannot replace slice of data that was already replacedThis likely indicates a bug in either rustc or cargo itself,
and we would appreciate a bug report! You're likely to see 
a number of compiler warnings after this message which cargo
attempted to fix but failed. If you could open an issue at
https://github.com/rust-lang/cargo/issues
quoting the full output of this command we'd be very appreciative!

warning: unreachable `pub` item
 --> src/main.rs:5:19
  |
5 |     pub use std::{io, fs};
  |     ---           ^^
  |     |
  |     help: consider restricting its visibility: `crate`
  |
note: lint level defined here
 --> src/main.rs:2:9
  |
2 | #![warn(rust_2018_idioms)]
  |         ^^^^^^^^^^^^^^^^
  = note: #[warn(unreachable_pub)] implied by #[warn(rust_2018_idioms)]
  = help: or consider exporting it for use by other crates

warning: unreachable `pub` item
 --> src/main.rs:5:23
  |
5 |     pub use std::{io, fs};
  |     ---               ^^
  |     |
  |     help: consider restricting its visibility: `crate`
  |
  = help: or consider exporting it for use by other crates

version info:

rustc 1.29.0-nightly (6a1c0637c 2018-07-23)
binary: rustc
commit-hash: 6a1c0637ce44aeea6c60527f4c0e7fb33f2bcd0d
commit-date: 2018-07-23
host: x86_64-unknown-linux-gnu
release: 1.29.0-nightly
LLVM version: 7.0
@alexcrichton
Copy link
Member

On second though this might be fixed by #52720, so we may want to test this again after that merges!

@nwoeanhinnogaehr
Copy link
Author

Yup, it's fixed in the latest nightly!

@fmease fmease added A-edition-2018 Area: The 2018 edition A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. and removed A-edition-2018-lints labels Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-edition-2018 Area: The 2018 edition A-lints Area: Lints (warnings about flaws in source code) such as unused_mut.
Projects
None yet
Development

No branches or pull requests

3 participants