Skip to content

ICE on closure typeck #66868

Closed
Closed
@jothan

Description

@jothan

I hit this problem while trying to make a task joining function. The problem occured when I started messing around with Arc<RwLock>.

The nightly compiler crashes on this too.

Problematic code:

Clone the smtpbis repo on the rustice branch.
https://github.com/zerospam/smtpbis.git

https://github.com/zerospam/smtpbis/commits/rustice
jothan/smtpbis@607ec56

Meta

rustc --version --verbose:
rustc 1.39.0 (4560ea7 2019-11-04)
binary: rustc
commit-hash: 4560ea7
commit-date: 2019-11-04
host: x86_64-unknown-linux-gnu
release: 1.39.0
LLVM version: 9.0

Backtrace:

RUST_BACKTRACE=1 cargo build --release
   Compiling smtpbis v0.1.4 (/home/joe/smtpbis)
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:378:21
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:76
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:60
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1030
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1412
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:64
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:196
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:210
  10: rustc_driver::report_ice
  11: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:477
  12: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:380
  13: rust_begin_unwind
             at src/libstd/panicking.rs:307
  14: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
  15: core::panicking::panic
             at src/libcore/panicking.rs:49
  16: rustc_typeck::check::typeck_tables_of
  17: rustc::ty::query::__query_compute::typeck_tables_of
  18: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute
  19: rustc::dep_graph::graph::DepGraph::with_task_impl
  20: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  21: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute
  22: rustc::dep_graph::graph::DepGraph::with_task_impl
  23: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  24: rustc::traits::error_reporting::<impl rustc::infer::InferCtxt>::note_obligation_cause
  25: rustc::traits::error_reporting::<impl rustc::infer::InferCtxt>::report_selection_error
  26: rustc::traits::error_reporting::<impl rustc::infer::InferCtxt>::report_fulfillment_errors
  27: rustc_typeck::check::FnCtxt::check_argument_types
  28: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::confirm_builtin_call
  29: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::check_call
  30: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  31: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  32: rustc_typeck::check::FnCtxt::check_decl_initializer
  33: rustc_typeck::check::FnCtxt::check_decl_local
  34: rustc_typeck::check::FnCtxt::check_stmt
  35: rustc_typeck::check::FnCtxt::check_block_with_expected
  36: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  37: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  38: rustc_typeck::check::FnCtxt::check_block_with_expected
  39: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  40: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  41: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_return_expr
  42: rustc_typeck::check::check_fn
  43: rustc_typeck::check::closure::<impl rustc_typeck::check::FnCtxt>::check_expr_closure
  44: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  45: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  46: rustc_typeck::check::FnCtxt::check_argument_types
  47: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::confirm_builtin_call
  48: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::check_call
  49: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  50: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  51: rustc_typeck::check::FnCtxt::check_argument_types
  52: rustc_typeck::check::FnCtxt::check_method_argument_types
  53: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  54: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  55: rustc_typeck::check::FnCtxt::check_block_with_expected
  56: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  57: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  58: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_return_expr
  59: rustc_typeck::check::check_fn
  60: rustc::ty::context::GlobalCtxt::enter_local
  61: rustc_typeck::check::typeck_tables_of
  62: rustc::ty::query::__query_compute::typeck_tables_of
  63: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute
  64: rustc::dep_graph::graph::DepGraph::with_task_impl
  65: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  66: rustc::ty::query::__query_compute::typeck_tables_of
  67: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute
  68: rustc::dep_graph::graph::DepGraph::with_task_impl
  69: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  70: rustc_typeck::collect::checked_type_of
  71: rustc_typeck::collect::type_of
  72: rustc::ty::query::__query_compute::type_of
  73: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::type_of>::compute
  74: rustc::dep_graph::graph::DepGraph::with_task_impl
  75: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  76: rustc::hir::intravisit::walk_expr
  77: rustc::hir::intravisit::walk_expr
  78: rustc::hir::intravisit::Visitor::visit_fn
  79: rustc::hir::intravisit::walk_item
  80: <rustc_typeck::collect::CollectItemTypesVisitor as rustc::hir::intravisit::Visitor>::visit_item
  81: rustc::hir::map::Map::visit_item_likes_in_module
  82: rustc_typeck::collect::collect_mod_item_types
  83: rustc::ty::query::__query_compute::collect_mod_item_types
  84: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::collect_mod_item_types>::compute
  85: rustc::dep_graph::graph::DepGraph::with_task_impl
  86: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  87: rustc_typeck::check_crate::{{closure}}::{{closure}}
  88: rustc::util::common::time
  89: rustc_typeck::check_crate
  90: rustc_interface::passes::analysis
  91: rustc::ty::query::__query_compute::analysis
  92: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  93: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}
  94: rustc_interface::passes::create_global_ctxt::{{closure}}
  95: rustc_interface::interface::run_compiler_in_existing_thread_pool
  96: std::thread::local::LocalKey<T>::with
  97: scoped_tls::ScopedKey<T>::set
  98: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.39.0 (4560ea788 2019-11-04) running on x86_64-unknown-linux-gnu

note: compiler flags: -C opt-level=3 --crate-type bin

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

query stack during panic:
#0 [typeck_tables_of] processing `smtpbis::taskjoin::join_tasks`
#1 [typeck_tables_of] processing `smtpbis::taskjoin::join_tasks::{{closure}}#0`
#2 [typeck_tables_of] processing `main`
#3 [typeck_tables_of] processing `main::{{closure}}#0`
#4 [type_of] processing `main::{{closure}}#0`
#5 [collect_mod_item_types] collecting item types in top-level module
#6 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `smtpbis`.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-closuresArea: Closures (`|…| { … }`)C-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions