Skip to content
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

error: multiple input filenames provided with missing crate name in clippy-driver invocation #7416

Closed
foresterre opened this issue Jul 1, 2021 · 2 comments
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@foresterre
Copy link

foresterre commented Jul 1, 2021

The error below is similar to a few issues, but none seem to have the same cause (as far as I'm aware), which is why I created a new issue instead of commenting on an earlier issue. Apologies if I misread those issues.


I tried to run cargo clippy with the following arguments:

cargo clippy --all-targets --all-features -- -D warnings

The first time I invoked this command it produced the following output (as expected!):

Output
rust-releases on  main [$?] is � v0.15.4 via � v1.53.0 
❯ cargo clippy --all-targets --all-features -- -D warnings
    Checking rust-releases-core v0.15.1 (C:\dev\rust-releases\crates\rust-releases-core)
    Checking rust-releases-io v0.15.1 (C:\dev\rust-releases\crates\rust-releases-io)
    Checking rust-releases-channel-manifests v0.15.1 (C:\dev\rust-releases\crates\rust-releases-channel-manifests)
    Checking rust-releases-rust-dist v0.15.1 (C:\dev\rust-releases\crates\rust-releases-rust-dist)
    Checking rust-releases-rust-dist-with-cli v0.15.1 (C:\dev\rust-releases\crates\rust-releases-rust-dist-with-cli)
    Checking rust-releases-rust-changelog v0.15.1 (C:\dev\rust-releases\crates\rust-releases-rust-changelog)
error: use of deprecated struct `ChannelManifests`
  --> crates\rust-releases-channel-manifests\src\lib.rs:40:17
   |
40 | impl Source for ChannelManifests {
   |                 ^^^^^^^^^^^^^^^^
   |
   = note: `-D deprecated` implied by `-D warnings`

error: use of deprecated struct `ChannelManifests`
  --> crates\rust-releases-channel-manifests\src\lib.rs:59:25
   |
59 | impl FetchResources for ChannelManifests {
   |                         ^^^^^^^^^^^^^^^^

error: use of deprecated field `ChannelManifests::documents`
  --> crates\rust-releases-channel-manifests\src\lib.rs:44:24
   |
44 |           let releases = self
   |  ________________________^
45 | |             .documents
   | |______________________^

error: use of deprecated field `ChannelManifests::documents`
  --> crates\rust-releases-channel-manifests\src\lib.rs:73:13
   |
73 |             documents: release_manifests,
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 4 previous errors

error: could not compile `rust-releases-channel-manifests`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

Then I ran:

cargo clippy --all --tests --all-features --all-targets -- -Dclippy::all

This command gave me the following unexpected error:

 
❯ cargo clippy --all --tests --all-features --all-targets -- -Dclippy::all
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `C:\Users\user\.rustup\toolchains\stable-x86_64-pc-windows-msvc\bin\clippy-driver.exe rustc - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --cr
ate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit code: 1)
  --- stderr
  error: multiple input filenames provided (first two filenames are `-` and `C:\dev\rust-releases\:all`)

To test whether the syntax of the command was incorrect I ran the first command again:

cargo clippy --all-targets --all-features -- -D warnings

which now also outputs:

error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `C:\Users\user\.rustup\toolchains\stable-x86_64-pc-windows-msvc\bin\clippy-driver.exe rustc - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --cr
ate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit code: 1)
  --- stderr
  error: multiple input filenames provided (first two filenames are `-` and `C:\dev\rust-releases\:all`)

I'm unsure how this change in behaviour came to be, but it seems like the crate name passed to clippy-driver is a bunch (three to be exact) of underscores. I am also unsure how to work around this issue.

Invoking clippy-driver with crate name substituted (hangs)

Invoking the failing command directly, but with the crate name replaced by my top-level crate seems to hang the clippy-driver process (looking at process explorer there's no ongoing computation), so it's probably not the correct way to call this:

C:\Users\user\.rustup\toolchains\stable-x86_64-pc-windows-msvc\bin\clippy-driver.exe rustc - --crate-name rust-releases --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-ty
pe cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg

Meta

  • cargo clippy -V: clippy 0.1.53 (53cb7b09 2021-06-17)
  • rustc -Vv:
rustc 1.53.0 (53cb7b09b 2021-06-17)
binary: rustc
commit-hash: 53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b
commit-date: 2021-06-17
host: x86_64-pc-windows-msvc
release: 1.53.0
LLVM version: 12.0.1
rustup toolchain list
❯ rustup toolchain list
stable-x86_64-pc-windows-gnu
stable-x86_64-pc-windows-msvc (default)
nightly-x86_64-pc-windows-msvc
1.25.0-x86_64-pc-windows-msvc
1.28.0-x86_64-pc-windows-msvc
1.29.2-x86_64-pc-windows-msvc
1.30.1-x86_64-pc-windows-msvc
1.31.1-x86_64-pc-windows-msvc
1.32.0-x86_64-pc-windows-msvc
1.33.0-x86_64-pc-windows-msvc
1.34.0-x86_64-pc-windows-msvc
1.34.2-x86_64-pc-windows-msvc
1.35.0-x86_64-pc-windows-msvc
1.36.0-x86_64-pc-windows-msvc
1.37.0-x86_64-pc-windows-msvc
1.38.0-x86_64-pc-windows-msvc
1.39.0-x86_64-pc-windows-msvc
1.40.0-x86_64-pc-windows-msvc
1.41.0-x86_64-pc-windows-msvc
1.41.1-x86_64-pc-windows-msvc
1.42.0-x86_64-pc-windows-msvc
1.43.0-x86_64-pc-windows-msvc
1.43.1-x86_64-pc-windows-msvc
1.44.0-x86_64-pc-windows-msvc
1.44.1-x86_64-pc-windows-msvc
1.45.0-x86_64-pc-windows-msvc
1.45.1-x86_64-pc-windows-msvc
1.45.2-x86_64-pc-windows-msvc
1.46.0-x86_64-pc-windows-msvc
1.47.0-x86_64-pc-windows-msvc
1.48.0-x86_64-pc-windows-msvc
1.49.0-x86_64-pc-windows-msvc
1.50.0-x86_64-pc-windows-msvc
1.51.0-x86_64-pc-windows-msvc
1.52.0-x86_64-pc-windows-msvc
1.52.1-x86_64-pc-windows-msvc

Compared to other issues which report a similar error message:

#2765: I checked, I've not customized the .cargo/config file; it doesn't exist.
#2602: Maybe a duplicate of this one? I also get the error immediately on invoking cargo-clippy, but not entirely sure.
#2001: I don't run it on a single file as far as I am aware
#2566: Running directly with ~/.cargo/bin/cargo-clippy produces the same error, unlike in this issue; the underlying cause of this issue which skipped one too many arguments doesn't seem to exist anymore in the latest master (but I'm not familiar with the code base)
#2484: I don't override rustc, where.exe rustc produces C:\Users\al\.cargo\bin\rustc.exe and looking at my env vars, RUSTC doesn't seem to exist.

Inconsistent between projects

Various other projects seem to work correctly, but for this one, re-cloning or cargo clean and running clippy again doesn't. If there's something else I can do to help, please let me know!

Edit: the cause of the error is probably a bit fragile; testing a bit more on the same repo gives inconsitent results; sometimes it does work after cargo clean && cargo clippy --all --tests --all-features -- -Dwarnings, which doesn't help for easy reproduction :(.

@foresterre foresterre added the C-bug Category: Clippy is not doing the correct thing label Jul 1, 2021
@foresterre foresterre changed the title error: multiple input filenames provided with empty crate name in clippy-driver invocation error: multiple input filenames provided with missing crate name in clippy-driver invocation Jul 1, 2021
@sanmai-NL
Copy link
Contributor

I experienced this fault when I replaced one macro in a main.rs file in a crate inside, but not member of a workspace with two crates.

@Alexendoo
Copy link
Member

Tracking in #12623 as it has a reproducer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing
Projects
None yet
Development

No branches or pull requests

3 participants