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

implicit-hasher ICE #4260

Closed
quininer opened this issue Jul 8, 2019 · 1 comment · Fixed by #4268
Closed

implicit-hasher ICE #4260

quininer opened this issue Jul 8, 2019 · 1 comment · Fixed by #4268
Labels
I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@quininer
Copy link
Contributor

quininer commented Jul 8, 2019

> cargo clippy -V
clippy 0.0.212 (316da7e 2019-07-07)

Running cargo clippy on this repo will report ICE.

Screenshot_20190708_151617

@phansch phansch added the I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ label Jul 8, 2019
@matthiaskrgr
Copy link
Member

Some observations: if I inline the macro definition into lib.rs, the crash goes away.

std::collections::HashMap is imported in lib.rs (where the macro is used), the macro only uses HashMap.
When I make the macro use the full path std::collections::HashMap, the snippet no longer crashes.

So there might be some path resolution failure?

Backtrace:

    Checking ice-clippy-implicit-hasher v0.1.0 (/tmp/ice-clippy-implicit-hasher)
thread 'rustc' panicked at 'begin <= end (1 <= 0) when slicing ` `', src/libcore/str/mod.rs:2026:5
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:47
   3: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:36
   4: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:200
   5: std::panicking::default_hook
             at src/libstd/panicking.rs:214
   6: rustc::util::common::panic_hook
   7: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:481
   8: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:384
   9: rust_begin_unwind
             at src/libstd/panicking.rs:311
  10: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
  11: core::str::slice_error_fail
             at src/libcore/str/mod.rs:0
  12: core::str::traits::<impl core::slice::SliceIndex<str> for core::ops::range::Range<usize>>::index::{{closure}}
  13: <clippy_lints::types::ImplicitHasher as rustc::lint::LateLintPass>::check_item::suggestion
  14: clippy_lints::utils::diagnostics::span_lint_and_then
  15: <clippy_lints::types::ImplicitHasher as rustc::lint::LateLintPass>::check_item
  16: <rustc::lint::context::LateLintPassObjects as rustc::lint::LateLintPass>::check_item
  17: rustc::hir::intravisit::Visitor::visit_nested_item
  18: rustc::hir::intravisit::walk_crate
  19: rustc::lint::context::late_lint_pass_crate
  20: rustc::lint::context::late_lint_crate
  21: rustc::util::common::time
  22: rustc::util::common::time
  23: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:82
  24: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  25: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:82
  26: rustc_interface::passes::analysis::{{closure}}
  27: rustc::util::common::time
  28: rustc_interface::passes::analysis
  29: rustc::ty::query::__query_compute::analysis
  30: rustc::dep_graph::graph::DepGraph::with_task_impl
  31: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  32: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}
  33: rustc_interface::passes::create_global_ctxt::{{closure}}
  34: rustc_interface::interface::run_compiler_in_existing_thread_pool
  35: std::thread::local::LocalKey<T>::with
  36: scoped_tls::ScopedKey<T>::set
  37: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
query stack during panic:
#0 [analysis] running analysis passes on this crate
end of query stack
warning: parameter of type `HashMap` should be generalized over different hashers
 --> lib.rs:3:1
  |
3 | macros::foo!();
  | ^^^^^^^^^^^^^^^
  |
  = note: #[warn(clippy::implicit_hasher)] on by default
  = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)


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-nightly (6e310f2ab 2019-07-07) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 -C incremental -C target-cpu=native --crate-type lib

note: some of the compiler flags provided by cargo are hidden

error: Could not compile `ice-clippy-implicit-hasher`.

To learn more, run the command again with --verbose.

bors added a commit that referenced this issue Jul 11, 2019
Fix bug in `implicit_hasher` causing crashes

Skip linting if the type is from an external macro. Closes #4260.

changelog: Fix bug in `implicit_hasher` causing crashes
bors added a commit that referenced this issue Jul 12, 2019
Fix bug in `implicit_hasher` causing crashes

Skip linting if the type is from an external macro. Closes #4260.

changelog: Fix bug in `implicit_hasher` causing crashes
flip1995 added a commit to flip1995/rust-clippy that referenced this issue Jul 12, 2019
Fix bug in `implicit_hasher` causing crashes

Skip linting if the type is from an external macro. Closes rust-lang#4260.

changelog: Fix bug in `implicit_hasher` causing crashes
bors added a commit that referenced this issue Jul 12, 2019
Fix bug in `implicit_hasher` causing crashes

Skip linting if the type is from an external macro. Closes #4260.

changelog: Fix bug in `implicit_hasher` causing crashes
bors added a commit that referenced this issue Jul 13, 2019
Fix bug in `implicit_hasher` causing crashes

Skip linting if the type is from an external macro. Closes #4260.

changelog: Fix bug in `implicit_hasher` causing crashes
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.

3 participants