Skip to content
This repository was archived by the owner on Nov 24, 2023. It is now read-only.
This repository was archived by the owner on Nov 24, 2023. It is now read-only.

Error applying replacements from module files #92

Closed
@killercup

Description

@killercup

It seems I have reintroduced a bug with regard to byte indices in module files.

Simple example: This change to rustfix itself

diff --git a/cargo-fix/src/cli.rs b/cargo-fix/src/cli.rs
index fbbdfe6..32a9bb4 100644
--- a/cargo-fix/src/cli.rs
+++ b/cargo-fix/src/cli.rs
@@ -107,6 +107,8 @@ fn log_for_human(kind: &str, msg: &str) -> Result<(), Error> {
     let mut stream = StandardStream::stderr(color_choice);
     stream.reset()?;
 
+    let mut i = 42;
+
     stream.set_color(ColorSpec::new().set_bold(true).set_fg(Some(Color::Cyan)))?;
     // Justify to 12 chars just like cargo
     write!(&mut stream, "{:>12}", kind)?;

leads to this output

Checking cargo-fix v0.2.0 (file:///Users/pascal/Projekte/rustfix/cargo-fix)
error: Could not find data slice that covers range 3823..3827
error: Could not compile `cargo-fix`.

That range looks an awful lot like the index in the whole crate's source, not in cli.rs. I'm pretty sure there is such a property in the compiler's json output, though, and I'm just not using it correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions