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

SIGSEGV applying clippy fixes #9942

Closed
matthiaskrgr opened this issue Nov 25, 2022 · 2 comments · Fixed by #10300
Closed

SIGSEGV applying clippy fixes #9942

matthiaskrgr opened this issue Nov 25, 2022 · 2 comments · Fixed by #10300
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ I-suggestion-causes-error Issue: The suggestions provided by this Lint cause an ICE/error when applied

Comments

@matthiaskrgr
Copy link
Member

Summary

// check-pass

mod x {
    pub use crate::y::*;
    pub use std::ops::Deref as _;
}

mod y {
    pub use crate::x::*;
    pub use std::ops::Deref as _;
}

pub fn main() {
    use x::*;
    (&0).deref();
}

If I process this code with cargo -vvvvvv clippy --fix -- -Wclippy::wildcard_imports I get some weird invalid memory reference crash but I can't see any compiler stacktrace unfortunately :(

warning: failed to automatically apply fixes suggested by rustc to crate `F`

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

  * src/main.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/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: expected identifier, found reserved identifier `_`
  --> src/main.rs:14:12
   |
14 |     use x::_;
   |            ^ expected identifier, found reserved identifier

rustc exited abnormally: signal: 11, SIGSEGV: invalid memory reference
Original diagnostics will follow.

warning: usage of wildcard import
  --> src/main.rs:14:9
   |
14 |     use x::*;
   |         ^^^^ help: try: `x::_`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_imports
   = note: requested on the command line with `-W clippy::wildcard-imports`

warning: crate `F` should have a snake case name
  |
  = help: convert the identifier to snake case: `f`
  = note: `#[warn(non_snake_case)]` on by default

warning: unused return value of `std::ops::Deref::deref` that must be used
  --> src/main.rs:15:5
   |
15 |     (&0).deref();
   |     ^^^^^^^^^^^^
   |
   = note: `#[warn(unused_must_use)]` on by default

warning: `F` (bin "F") generated 3 warnings (run `cargo fix --bin "F"` to apply 1 suggestion)
warning: `F` (bin "F" test) generated 3 warnings (3 duplicates)
    Finished dev [unoptimized + debuginfo] target(s) in 0.18s

Version

rustc 1.67.0-nightly (70f8737b2 2022-11-23)
binary: rustc
commit-hash: 70f8737b2f5d3bf7d6b784fad00b663b7ff9feda
commit-date: 2022-11-23
host: x86_64-unknown-linux-gnu
release: 1.67.0-nightly
LLVM version: 15.0.4

Error output

No response

@matthiaskrgr matthiaskrgr added C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ I-suggestion-causes-error Issue: The suggestions provided by this Lint cause an ICE/error when applied labels Nov 25, 2022
@smoelius
Copy link
Contributor

smoelius commented Nov 25, 2022

@matthiaskrgr Are you fuzzing Clippy? Is your approach described somewhere?

@matthiaskrgr
Copy link
Member Author

Im running clippy --fix on all sorts of rust files and check if the suggestion applies. :)

https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/moar.20lint.20checking

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 I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ I-suggestion-causes-error Issue: The suggestions provided by this Lint cause an ICE/error when applied
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants