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

internal compiler error in clippy #7236

Closed
fanf2 opened this issue May 17, 2021 · 2 comments
Closed

internal compiler error in clippy #7236

fanf2 opened this issue May 17, 2021 · 2 comments

Comments

@fanf2
Copy link

fanf2 commented May 17, 2021

I am trying to run clippy on this code: https://github.com/fanf2/dnstrie/tree/clippy-ice

I am using: clippy 0.1.52 (9bc8c42b 2021-05-09) on macOS

Output from RUST_BACKTRACE=1 cargo clippy:

error: internal compiler error: compiler/rustc_middle/src/ty/query/mod.rs:279:1: `tcx.item_children(DefId(0:120 ~ dnstrie[da22]::dnsname))` unsupported by its crate

thread 'rustc' panicked at 'Box<Any>', /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/panic.rs:59:5
stack backtrace:
   0: std::panicking::begin_panic
   1: std::panic::panic_any
   2: rustc_errors::HandlerInner::bug
   3: rustc_errors::Handler::bug
   4: rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}
   5: rustc_middle::ty::context::tls::with_opt::{{closure}}
   6: rustc_middle::ty::context::tls::with_opt
   7: rustc_middle::util::bug::opt_span_bug_fmt
   8: rustc_middle::util::bug::bug_fmt
   9: <rustc_middle::ty::query::Providers as core::default::Default>::default::{{closure}}
  10: core::ops::function::FnOnce::call_once
  11: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  12: rustc_data_structures::stack::ensure_sufficient_stack
  13: rustc_query_system::query::plumbing::force_query_with_job
  14: rustc_query_system::query::plumbing::get_query_impl
  15: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::item_children
  16: <clippy_lints::macro_use::MacroUseImports as rustc_lint::passes::LateLintPass>::check_item
  17: <rustc_lint::late::LateLintPassObjects as rustc_lint::passes::LateLintPass>::check_item
  18: rustc_hir::intravisit::Visitor::visit_nested_item
  19: rustc_hir::intravisit::walk_item
  20: rustc_hir::intravisit::Visitor::visit_nested_item
  21: rustc_hir::intravisit::walk_item
  22: rustc_hir::intravisit::Visitor::visit_nested_item
  23: rustc_hir::intravisit::walk_crate
  24: rustc_lint::late::late_lint_pass_crate
  25: rustc_lint::late::late_lint_crate
  26: rustc_data_structures::sync::join
  27: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  28: rustc_session::utils::<impl rustc_session::session::Session>::time
  29: rustc_interface::passes::analysis
  30: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  31: rustc_data_structures::stack::ensure_sufficient_stack
  32: rustc_query_system::query::plumbing::force_query_with_job
  33: rustc_query_system::query::plumbing::get_query_impl
  34: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  35: rustc_interface::passes::QueryContext::enter
  36: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  37: rustc_span::with_source_map
  38: rustc_interface::interface::create_compiler_and_run
  39: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.52 (9bc8c42b 2021-05-09)

query stack during panic:
#0 [item_children] collecting child items of `dnsname`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error; 2 warnings emitted

error: could not compile `dnstrie`
@fanf2
Copy link
Author

fanf2 commented May 18, 2021

Note this code is currently broken work in progress, a total mess 😁

The ICE goes away if I tweak the #[macro_use] a bit,

diff --git src/dnsname/temp.rs src/dnsname/temp.rs
index a223c74..1a39518 100644
--- src/dnsname/temp.rs
+++ src/dnsname/temp.rs
@@ -4,7 +4,6 @@
 //! This kind of name is decompressed and canonicalized to lower case.
 //! The name and label pointers are stored in its workpad.
 
-#[macro_use]
 use super::*;
 use core::convert::TryInto;
 
@@ -64,6 +63,7 @@ impl<'n> std::fmt::Display for TempName {
 
 #[cfg(test)]
 mod test {
+    #[macro_use]
     use super::*;
 
     #[test]

@giraffate
Copy link
Contributor

This is fixed at Rust 1.53 (currently beta) by #7022. So I'm closing this.

Anyway, thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants