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

clippy-driver passes --sysroot more than once #12201

Closed
daivinhtran opened this issue Jan 25, 2024 · 1 comment · Fixed by #12203
Closed

clippy-driver passes --sysroot more than once #12201

daivinhtran opened this issue Jan 25, 2024 · 1 comment · Fixed by #12203
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@daivinhtran
Copy link
Contributor

daivinhtran commented Jan 25, 2024

Summary

The Bazel rules set for rust pass the same flags to clippy-driver as it would pass to rustc. This has worked till we hit a corner case (see bazelbuild/rules_rust#2447) where we set both --sysroot flag and SYSROOT env var and the --sysroot flag ends up in a param file that rustc correctly handles.

Reproducer

  1. Create a file @program.params with --sysroot=""
  2. Run SYSROOT="" clippy-driver @program.params

I expected to see the command not to fail because SYSROOT="" clippy-driver --sysroot works fine.

Instead, it fails with

error: Option 'sysroot' given more than once

because

let has_sysroot_arg = arg_value(&orig_args, "--sysroot", |_| true).is_some();

checks whether the args includes --sysroot but doesn't check whether @program.params includes --sysroot.

Version

rustc 1.75.0 (82e1608df 2023-12-21)
binary: rustc
commit-hash: 82e1608dfa6e0b5569232559e3d385fea5a93112
commit-date: 2023-12-21
host: aarch64-apple-darwin
release: 1.75.0
LLVM version: 17.0.6

Additional Labels

No response

@daivinhtran daivinhtran added the C-bug Category: Clippy is not doing the correct thing label Jan 25, 2024
@daivinhtran
Copy link
Contributor Author

cc: @UebelAndre @illicitonion

daivinhtran pushed a commit to daivinhtran/rust-clippy that referenced this issue Jan 29, 2024
bors added a commit that referenced this issue Jan 29, 2024
…file, r=flip1995

Makes clippy-driver check for --sysroot in arg files

Fixes #12201

---

changelog: none

cc: `@UebelAndre` `@illicitonion`
@bors bors closed this as completed in 73706e8 Jan 29, 2024
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

Successfully merging a pull request may close this issue.

1 participant