Skip to content

ICE when testing new clippy lint #92550

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
J-ZhengLi opened this issue Jan 4, 2022 · 2 comments
Closed

ICE when testing new clippy lint #92550

J-ZhengLi opened this issue Jan 4, 2022 · 2 comments
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@J-ZhengLi
Copy link
Member

I tried to learn some clippy lint development today but I just couldn't get my head around this annoying error, It seems like this Internal Compiler Error appears whenever I made any change to the original files, even by reverting all the changes doesn't make the error go away, only by deleting the /target folder and rebuild the whole thing does.

Code

In rust-clippy/test/ui/test_attr.rs

#![warn(clippy::test_attr)]
#![allow(clippy::new_without_default)]

struct A;

impl A {
    #[doc(hidden)]
    fn new() -> Self { A }
}

// After adding above lines, runing `TESTNAME=test_attr cargo uitest` gives ICE
// but after removing /terget folder and run the uitest again, the error no longer appears.
// Then I add this `foo` function and run the uitest, the error shows up again.
fn foo() {}

fn main() {
    foo();
}

Meta

rustc --version --verbose:

rustc 1.59.0-nightly (78fd0f633 2021-12-29)
binary: rustc
commit-hash: 78fd0f633faaa5b6dd254fc1456735f63a1b1238
commit-date: 2021-12-29
host: x86_64-unknown-linux-gnu
release: 1.59.0-nightly
LLVM version: 13.0.0

Error output

   Compiling clippy_lints v0.1.59 (/home/jlee/Documents/Workspace/cloned/rust-clippy/clippy_lints)
thread 'rustc' panicked at 'failed to lookup `SourceFile` in new context', compiler/rustc_query_impl/src/on_disk_cache.rs:500:22
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.59.0-nightly (78fd0f633 2021-12-29) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z unstable-options -Z binary-dep-depinfo -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib

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

query stack during panic:
#0 [type_of] computing type of `dereference::Dereferencing::ref_locals`
#1 [inferred_outlives_crate] computing the inferred outlives predicates for items in this crate
end of query stack
error: could not compile `clippy_lints`
Backtrace

stack backtrace:
   0: rust_begin_unwind
             at /rustc/78fd0f633faaa5b6dd254fc1456735f63a1b1238/library/std/src/panicking.rs:498:5
   1: core::panicking::panic_fmt
             at /rustc/78fd0f633faaa5b6dd254fc1456735f63a1b1238/library/core/src/panicking.rs:107:14
   2: core::panicking::panic_display
             at /rustc/78fd0f633faaa5b6dd254fc1456735f63a1b1238/library/core/src/panicking.rs:63:5
   3: core::panicking::panic_str
             at /rustc/78fd0f633faaa5b6dd254fc1456735f63a1b1238/library/core/src/panicking.rs:55:5
   4: core::option::expect_failed
             at /rustc/78fd0f633faaa5b6dd254fc1456735f63a1b1238/library/core/src/option.rs:1821:5
   5: <rustc_span::span_encoding::Span as rustc_serialize::serialize::Decodable<rustc_query_impl::on_disk_cache::CacheDecoder>>::decode
   6: <rustc_middle::ty::VariantDef as rustc_serialize::serialize::Decodable<rustc_query_impl::on_disk_cache::CacheDecoder>>::decode
   7: <rustc_query_impl::on_disk_cache::CacheDecoder as rustc_serialize::serialize::Decoder>::read_seq::<alloc::vec::Vec<rustc_middle::ty::VariantDef>, <alloc::vec::Vec<rustc_middle::ty::VariantDef> as rustc_serialize::serialize::Decodable<rustc_query_impl::on_disk_cache::CacheDecoder>>::decode::{closure#0}>
   8: <rustc_middle::ty::adt::AdtDef as rustc_serialize::serialize::Decodable<rustc_query_impl::on_disk_cache::CacheDecoder>>::decode
   9: <rustc_middle::ty::sty::TyKind as rustc_serialize::serialize::Decodable<rustc_query_impl::on_disk_cache::CacheDecoder>>::decode
  10: <&rustc_middle::ty::TyS as rustc_serialize::serialize::Decodable<rustc_query_impl::on_disk_cache::CacheDecoder>>::decode
  11: <rustc_query_impl::on_disk_cache::OnDiskCache>::try_load_query_result::<&rustc_middle::ty::TyS>
  12: rustc_query_system::query::plumbing::try_load_from_disk_and_cache_in_memory::<rustc_query_impl::plumbing::QueryCtxt, rustc_span::def_id::DefId, &rustc_middle::ty::TyS>
  13: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::type_of
  14: <rustc_typeck::outlives::implicit_infer::InferVisitor as rustc_hir::itemlikevisit::ItemLikeVisitor>::visit_item
  15: <rustc_middle::hir::map::Map>::visit_all_item_likes::<rustc_typeck::outlives::implicit_infer::InferVisitor>
  16: rustc_typeck::outlives::inferred_outlives_crate
  17: <rustc_middle::dep_graph::dep_node::DepKind as rustc_query_system::dep_graph::DepKind>::with_deps::<<rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task_impl<rustc_middle::ty::context::TyCtxt, (), rustc_middle::ty::CratePredicatesMap>::{closure#0}, rustc_middle::ty::CratePredicatesMap>
  18: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), rustc_middle::ty::CratePredicatesMap>
  19: rustc_data_structures::stack::ensure_sufficient_stack::<(rustc_middle::ty::CratePredicatesMap, rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, (), rustc_middle::ty::CratePredicatesMap>::{closure#3}>
  20: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::ArenaCache<(), rustc_middle::ty::CratePredicatesMap>>
  21: rustc_query_system::query::plumbing::force_query::<rustc_query_impl::queries::inferred_outlives_crate, rustc_query_impl::plumbing::QueryCtxt>
  22: rustc_query_impl::query_callbacks::inferred_outlives_crate::force_from_dep_node
  23: <rustc_middle::ty::context::TyCtxt as rustc_query_system::dep_graph::DepContext>::try_force_from_dep_node
  24: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
  25: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
  26: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
  27: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
  28: rustc_query_system::query::plumbing::ensure_must_run::<rustc_query_impl::plumbing::QueryCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::mir::query::BorrowCheckResult>
  29: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::collect_mod_item_types, rustc_query_impl::plumbing::QueryCtxt>
  30: <rustc_middle::hir::map::Map>::for_each_module::<rustc_typeck::check_crate::{closure#0}::{closure#0}::{closure#0}>
  31: <rustc_session::session::Session>::track_errors::<rustc_typeck::check_crate::{closure#0}, ()>
  32: rustc_typeck::check_crate
  33: rustc_interface::passes::analysis
  34: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), core::result::Result<(), rustc_errors::ErrorReported>>
  35: rustc_data_structures::stack::ensure_sufficient_stack::<(core::result::Result<(), rustc_errors::ErrorReported>, rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, (), core::result::Result<(), rustc_errors::ErrorReported>>::{closure#3}>
  36: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), core::result::Result<(), rustc_errors::ErrorReported>>>
  37: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
  38: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorReported>>
  39: <rustc_interface::interface::Compiler>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorReported>>
  40: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#1}>
  41: rustc_interface::interface::create_compiler_and_run::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@J-ZhengLi J-ZhengLi added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 4, 2022
@matthiaskrgr
Copy link
Member

This likely a duplicate of #92163
Problem is that while this has already been fixed on maste/nightly, clippy is currently pinned to a rustc version that probably doesn't have fix yet, the next rustc <-> clippy sync should fix that.

And yes cargo clean should fix the problem, at least until next time :)

@J-ZhengLi
Copy link
Member Author

This likely a duplicate of #92163 Problem is that while this has already been fixed on maste/nightly, clippy is currently pinned to a rustc version that probably doesn't have fix yet, the next rustc <-> clippy sync should fix that.

And yes cargo clean should fix the problem, at least until next time :)

Thank you for the info, closing the issue now~

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants