Skip to content

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

Closed
@nwoeanhinnogaehr

Description

@nwoeanhinnogaehr

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-edition-2018Area: The 2018 editionA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions