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 crashes without arguments (index out of bounds) #4716

Closed
ashemedai opened this issue Oct 22, 2019 · 6 comments · Fixed by #4810
Closed

clippy-driver crashes without arguments (index out of bounds) #4716

ashemedai opened this issue Oct 22, 2019 · 6 comments · Fixed by #4810
Labels
I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@ashemedai
Copy link

Ran clippy-driver without parameters and got an ICE.

I tried this code:

clippy-driver

I expected to see this happen: See some help output

Instead, this happened: received an ICE

Meta

rustc --version --verbose:

% rustc --version --verbose
rustc 1.38.0 (625451e37 2019-09-23)
binary: rustc
commit-hash: 625451e376bb2e5283fc4741caa0a3e8a2ca4d54
commit-date: 2019-09-23
host: x86_64-apple-darwin
release: 1.38.0
LLVM version: 9.0
% cargo clippy -V
clippy 0.0.212 (3aea8603 2019-09-03)

Backtrace:

% RUST_BACKTRACE=1 clippy-driver
thread 'main' panicked at 'index out of bounds: the len is 1 but the index is 1', /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libcore/slice/mod.rs:2715:10
stack backtrace:
   0: std::panicking::default_hook::{{closure}}
   1: std::panicking::default_hook
   2: std::panicking::rust_panic_with_hook
   3: std::panicking::continue_panic_fmt
   4: rust_begin_unwind
   5: core::panicking::panic_fmt
   6: core::panicking::panic_bounds_check
   7: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
   8: std::panicking::try::do_call
   9: __rust_maybe_catch_panic
  10: rustc_driver::report_ices_to_stderr_if_any
  11: clippy_driver::main
  12: std::rt::lang_start::{{closure}}
  13: std::panicking::try::do_call
  14: __rust_maybe_catch_panic
  15: std::rt::lang_start_internal
  16: main

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.38.0 (625451e37 2019-09-23) running on x86_64-apple-darwin
@phansch
Copy link
Member

phansch commented Oct 22, 2019

Could you try running the command with RUST_BACKTRACE=full as well? That should give a bit more information. If possible, could you also provide the source code where this crash happens?

@phansch phansch added the I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ label Oct 22, 2019
@mati865
Copy link
Contributor

mati865 commented Oct 22, 2019

@phansch it crashes without any code. It's not a lint but rather clippy-driver binary what crashes here.

@mati865
Copy link
Contributor

mati865 commented Oct 22, 2019

It must be this line:

let wrapper_mode = Path::new(&orig_args[1]).file_stem() == Some("rustc".as_ref());

@matthiaskrgr matthiaskrgr changed the title Clippy ICE on invocation clippy-driver crashes without arguments (index out of bounds) Oct 22, 2019
@ashemedai
Copy link
Author

What @mati865 says, just running it in an empty directory without any arguments. I can get you a full backtrace tomorrow morning, as needed.

@llogiq
Copy link
Contributor

llogiq commented Oct 23, 2019

Yeah, we should probably check if there is any arg in orig_args and issue some usage info otherwise.

@ashemedai
Copy link
Author

Full backtrace:

% RUST_BACKTRACE=full clippy-driver
thread 'main' panicked at 'index out of bounds: the len is 1 but the index is 1', /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libcore/slice/mod.rs:2715:10
stack backtrace:
   0:        0x10b3f5c92 - std::panicking::default_hook::{{closure}}::h3f994bbc901f9889
   1:        0x10b3f595d - std::panicking::default_hook::h6c261b7dad1af707
   2:        0x10b3f6470 - std::panicking::rust_panic_with_hook::hd3c20890ac648923
   3:        0x10b3f5fad - std::panicking::continue_panic_fmt::hf444d349a369432b
   4:        0x10b3f5e99 - rust_begin_unwind
   5:        0x10b421c12 - core::panicking::panic_fmt::h7bf9e431fd27d405
   6:        0x10b421bc9 - core::panicking::panic_bounds_check::h945cc15e7a0d27ba
   7:        0x10ad9f3b3 - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::hd67d0aeef970b729
   8:        0x10ad8f15e - std::panicking::try::do_call::h11c6ee48236c5b67
   9:        0x10b4057cf - __rust_maybe_catch_panic
  10:        0x10ad88e12 - rustc_driver::report_ices_to_stderr_if_any::h67c06ffbfebe6f4c
  11:        0x10ad9ca9e - clippy_driver::main::h2220a55246cb76db
  12:        0x10ad8f146 - std::rt::lang_start::{{closure}}::h61b9bee55274c3f2
  13:        0x10b3f5e18 - std::panicking::try::do_call::h8ffcb2a43dbb732c
  14:        0x10b4057cf - __rust_maybe_catch_panic
  15:        0x10b3f68ee - std::rt::lang_start_internal::ha688fd553625ef6f
  16:        0x10ad9cad9 - main

error: internal compiler error: unexpected panic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants