rust-lang / rust-lang/rust-clippy

clippy reports: `after fixes were automatically applied the compiler reported errors within these files`

Open
#15,058 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

Summary

When running cargo clippy --fix, it reports:

after fixes were automatically applied the compiler reported errors within these files:

  * ladspa.rs/src/ffi.rs

This 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/rust-clippy/issues
quoting the full output of this command we'd be very appreciative!
Note that you may be able to make some more progress in the near-term
fixing code with the `--broken-code` flag
Reproducer

I tried this code:

sean@ondo:~$ git clone -b clippy-bug https://github.com/xobs/ladspa.rs
Cloning into 'ladspa.rs'...
remote: Enumerating objects: 252, done.
remote: Counting objects: 100% (25/25), done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 252 (delta 12), reused 15 (delta 6), pack-reused 227 (from 1)
Receiving objects: 100% (252/252), 51.06 KiB | 8.51 MiB/s, done.
Resolving deltas: 100% (125/125), done.
sean@ondo:~$ cd ladspa.rs
sean@ondo:~/ladspa.rs$ cargo clippy --fix

I expected to see this happen:

Clippy fixes any warnings, or at least doesn't break things.

Instead, this happened:

after fixes were automatically applied the compiler reported errors within these files:

  * src/ffi.rs

This 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/rust-clippy/issues
quoting the full output of this command we'd be very appreciative!
Note that you may be able to make some more progress in the near-term
fixing code with the `--broken-code` flag

The following errors were reported:
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `ffi`
   --> src/ffi.rs:298:59
    |
298 |         let handle: &mut Handle = &mut *(instance as *mut ffi::Handle<'_>);
    |                                                           ^^^ use of unresolved module or unlinked crate `ffi`
    |
    = help: if you wanted to use a crate named `ffi`, use `cargo add ffi` to add it to your `Cargo.toml`
help: consider importing this module
    |
1   + use crate::ffi;
    |

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `ffi`
   --> src/ffi.rs:331:63
    |
331 |         let handle_ptr: &mut Handle = &mut *(instance as *mut ffi::Handle<'_>);
    |                                                               ^^^ use of unresolved module or unlinked crate `ffi`
    |
    = help: if you wanted to use a crate named `ffi`, use `cargo add ffi` to add it to your `Cargo.toml`
help: consider importing this module
    |
1   + use crate::ffi;
    |

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `ffi`
   --> src/ffi.rs:349:59
    |
349 |         let handle: &mut Handle = &mut *(instance as *mut ffi::Handle<'_>);
    |                                                           ^^^ use of unresolved module or unlinked crate `ffi`
    |
    = help: if you wanted to use a crate named `ffi`, use `cargo add ffi` to add it to your `Cargo.toml`
help: consider importing this module
    |
1   + use crate::ffi;
    |

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `ffi`
   --> src/ffi.rs:381:59
    |
381 |         let handle: &mut Handle = &mut *(instance as *mut ffi::Handle<'_>);
    |                                                           ^^^ use of unresolved module or unlinked crate `ffi`
    |
    = help: if you wanted to use a crate named `ffi`, use `cargo add ffi` to add it to your `Cargo.toml`
help: consider importing this module
    |
1   + use crate::ffi;
    |

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `ffi`
   --> src/ffi.rs:396:59
    |
396 |         let handle: &mut Handle = &mut *(instance as *mut ffi::Handle<'_>);
    |                                                           ^^^ use of unresolved module or unlinked crate `ffi`
    |
    = help: if you wanted to use a crate named `ffi`, use `cargo add ffi` to add it to your `Cargo.toml`
help: consider importing this module
    |
1   + use crate::ffi;
    |

error[E0596]: cannot borrow `*descriptor` as mutable, as it is behind a `*const` pointer
   --> src/ffi.rs:260:47
    |
260 |         let desc: &mut ladspa_h::Descriptor = &mut *descriptor;
    |                                               ^^^^^^^^^^^^^^^^ `descriptor` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable
    |
help: consider changing this to be a mutable pointer
    |
247 |     descriptor: *mut const ladspa_h::Descriptor,
    |                  +++

error: aborting due to 6 previous errors

Some errors have detailed explanations: E0433, E0596.
For more information about an error, try `rustc --explain E0433`.
Original diagnostics will follow.

warning: `ladspa` (lib) generated 39 warnings (39 duplicates)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.53s
Version
rustc 1.87.0 (17067e9ac 2025-05-09)
binary: rustc
commit-hash: 17067e9ac6d7ecb70e50f92c1944e545188d2359
commit-date: 2025-05-09
host: x86_64-unknown-linux-gnu
release: 1.87.0
LLVM version: 20.1.1
Additional Labels

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the report with the ladspa.rs clippy-bug branch and cargo clippy --fix, focusing on the edits and compiler errors in src/ffi.rs. Compare the applied fixes with the original diagnostics and verify that automatic fixes no longer leave the crate failing to compile.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.