Skip to content

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

Open
@xobs

Description

@xobs

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions