Skip to content

ICE unwrap of none value in librustc_hir/definitions.rs #74318

Closed
@hellow554

Description

@hellow554

While trying to minify the ICE from #73537 I stumpled upon a different ICE.

Backtrace
error[E0706]: functions in traits cannot be declared `async`
  --> amadeus-core/src/par_stream.rs:62:5
   |
62 |       async fn reduce<P, B, R1F, R1, R3>(
   |       ^----
   |       |
   |  _____`async` because of this
   | |
63 | |         self,
64 | |     ) {
65 | |         let handles = vec![]
66 | |             .into_iter()
67 | |             .map(|tasks| {});
68 | |     }
   | |_____^
   |
   = note: `async` trait functions are not currently supported
   = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /rustc/3503f565e1fb7296983757d2716346f48a4a262b/src/librustc_hir/definitions.rs:316:35
stack backtrace:
   0:     0x7f32261edf05 - backtrace::backtrace::libunwind::trace::h34afbfad7fd770fc
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1:     0x7f32261edf05 - backtrace::backtrace::trace_unsynchronized::h460d522b1619a600
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2:     0x7f32261edf05 - std::sys_common::backtrace::_print_fmt::ha45fac10086813b4
                               at src/libstd/sys_common/backtrace.rs:78
   3:     0x7f32261edf05 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hde84f63fcfd0e6de
                               at src/libstd/sys_common/backtrace.rs:59
   4:     0x7f322622b49c - core::fmt::write::h540ac4a6a1232abc
                               at src/libcore/fmt/mod.rs:1076
   5:     0x7f32261dfd72 - std::io::Write::write_fmt::hc344eafd6e850b4d
                               at src/libstd/io/mod.rs:1537
   6:     0x7f32261f2e30 - std::sys_common::backtrace::_print::h4db88ff15cb5d61d
                               at src/libstd/sys_common/backtrace.rs:62
   7:     0x7f32261f2e30 - std::sys_common::backtrace::print::h5fc39e1b1f610bd3
                               at src/libstd/sys_common/backtrace.rs:49
   8:     0x7f32261f2e30 - std::panicking::default_hook::{{closure}}::h59e55edacb1d974a
                               at src/libstd/panicking.rs:198
   9:     0x7f32261f2b7c - std::panicking::default_hook::heee4c8016dfbf328
                               at src/libstd/panicking.rs:217
  10:     0x7f322695ea73 - rustc_driver::report_ice::h26eb523a40d729cf
  11:     0x7f321bbf7216 - <alloc::boxed::Box<F> as core::ops::function::Fn<A>>::call::h082305267bbe2157
                               at /rustc/3503f565e1fb7296983757d2716346f48a4a262b/src/liballoc/boxed.rs:1095
  12:     0x7f321bc05fb5 - proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}::{{closure}}::h93042890da1620b3
                               at /rustc/3503f565e1fb7296983757d2716346f48a4a262b/src/libproc_macro/bridge/client.rs:318
  13:     0x7f32261f35a8 - std::panicking::rust_panic_with_hook::h8405b6301c79fb5a
                               at src/libstd/panicking.rs:524
  14:     0x7f32261f317b - rust_begin_unwind
                               at src/libstd/panicking.rs:431
  15:     0x7f3226228041 - core::panicking::panic_fmt::h78830ea6a34e7206
                               at src/libcore/panicking.rs:85
  16:     0x7f3226227f8d - core::panicking::panic::h68e56c2eeba99c8c
                               at src/libcore/panicking.rs:50
  17:     0x7f3228ee2e18 - rustc_middle::hir::map::Map::def_kind::hafb262fbf0d38c75
  18:     0x7f3228ed701a - core::ops::function::FnOnce::call_once::hf8c5a3a31d68c4c7
  19:     0x7f32293d0bb1 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::hddf6668a514f1551
  20:     0x7f3228e598dd - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hc013b7ff2582024e
  21:     0x7f3229154952 - rustc_data_structures::stack::ensure_sufficient_stack::h52380575085609a2
  22:     0x7f3228f872aa - rustc_query_system::query::plumbing::get_query_impl::hb3a05b7f5b583756
  23:     0x7f32291c0a80 - rustc_middle::ty::util::<impl rustc_middle::ty::context::TyCtxt>::closure_base_def_id::h17764ecfb292c8f3
  24:     0x7f3227596f30 - rustc_typeck::collect::generics_of::h2d71d824fa4bf7bc
  25:     0x7f3227569c2b - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::generics_of>::compute::h69cce6614aed3c59
  26:     0x7f32273fb043 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h5f4e1d0635b188f7
  27:     0x7f3227511126 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h606eb85f7cd1a802
  28:     0x7f3227544ec9 - rustc_data_structures::stack::ensure_sufficient_stack::h55c904426c20f7fc
  29:     0x7f322745f7d8 - rustc_query_system::query::plumbing::get_query_impl::h57da19642e9c745d
  30:     0x7f32274a4f64 - rustc_query_system::query::plumbing::ensure_query_impl::h94dcd0801933967a
  31:     0x7f32274e9d7f - rustc_hir::intravisit::walk_expr::hf083e7c97404000d
  32:     0x7f3227592bd9 - <rustc_typeck::collect::CollectItemTypesVisitor as rustc_hir::intravisit::Visitor>::visit_expr::h4760b49ab9b8385b
  33:     0x7f32275845ce - rustc_hir::intravisit::Visitor::visit_stmt::hd7d75fd2d63dd139
  34:     0x7f32274ea23f - rustc_hir::intravisit::walk_expr::hf083e7c97404000d
  35:     0x7f32274e5f8e - rustc_hir::intravisit::walk_body::h56da48f921ac51fb
  36:     0x7f32274d89ae - rustc_hir::intravisit::walk_trait_item::h6dbdc62e387e3321
  37:     0x7f3227592f0d - <rustc_typeck::collect::CollectItemTypesVisitor as rustc_hir::intravisit::Visitor>::visit_trait_item::h585101dc821ed179
  38:     0x7f32274fe2b8 - rustc_middle::hir::map::Map::visit_item_likes_in_module::h2fc5c339188d4a79
  39:     0x7f32275907c4 - rustc_typeck::collect::collect_mod_item_types::h14a5b9d007c58603
  40:     0x7f322760a835 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::collect_mod_item_types>::compute::h55f7d1c38c919e5c
  41:     0x7f32273fbad1 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h71d6d4a6cdfbae36
  42:     0x7f3227513f94 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::haf98227a6d0ddc0c
  43:     0x7f32275467a3 - rustc_data_structures::stack::ensure_sufficient_stack::h84406c3b568f39a8
  44:     0x7f32274a16e3 - rustc_query_system::query::plumbing::get_query_impl::hfa21f15e8339624f
  45:     0x7f32274a4aee - rustc_query_system::query::plumbing::ensure_query_impl::h8af3ba1f8784298a
  46:     0x7f322760cd03 - rustc_session::session::Session::track_errors::h33a1cb2fba4e84c5
  47:     0x7f32275a408b - rustc_typeck::check_crate::hd09a544480ba7537
  48:     0x7f3226b001af - rustc_interface::passes::analysis::h3a6008da1c156296
  49:     0x7f322694666b - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute::hae71a7f9d73047a0
  50:     0x7f3226947df8 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h6c2ce8b92f30caac
  51:     0x7f32269bb644 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hfe3c0a8b0dcc9800
  52:     0x7f32269be959 - rustc_data_structures::stack::ensure_sufficient_stack::h80ac0f704de7cdf6
  53:     0x7f3226924644 - rustc_query_system::query::plumbing::get_query_impl::hebe8aa5a8aac99c3
  54:     0x7f3226946b0f - rustc_middle::ty::context::tls::enter_global::h614eb6f235bbc020
  55:     0x7f32269193fa - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::hb3ecfe94ca03e6c6
  56:     0x7f32269b9343 - rustc_span::with_source_map::h21eed361cfe861de
  57:     0x7f322691ab16 - rustc_interface::interface::run_compiler_in_existing_thread_pool::h902d0e3e1f552acf
  58:     0x7f32269441bd - scoped_tls::ScopedKey<T>::set::hbc88e7d76dd9a901
  59:     0x7f322696a81a - std::sys_common::backtrace::__rust_begin_short_backtrace::h0f0c30d1296961bc
  60:     0x7f32269275be - core::ops::function::FnOnce::call_once{{vtable.shim}}::h36b2cf3218c61088
  61:     0x7f3226202daa - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h13d34828db364579
                               at /rustc/3503f565e1fb7296983757d2716346f48a4a262b/src/liballoc/boxed.rs:1081
  62:     0x7f3226202daa - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::hd51b619e0f884abf
                               at /rustc/3503f565e1fb7296983757d2716346f48a4a262b/src/liballoc/boxed.rs:1081
  63:     0x7f3226202daa - std::sys::unix::thread::Thread::new::thread_start::h02c6e34c2c73f344
                               at src/libstd/sys/unix/thread.rs:87
  64:     0x7f322614b432 - start_thread
  65:     0x7f32260679d3 - __clone
  66:                0x0 - <unknown>

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.46.0-nightly (3503f565e 2020-07-02) running on x86_64-unknown-linux-gnu

note: compiler flags: -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 [def_kind] looking up definition kind of `par_stream::ParallelStream::reduce::{{closure}}#0`
#1 [generics_of] computing generics of `par_stream::ParallelStream::reduce::{{closure}}#0::{{closure}}#0`
#2 [collect_mod_item_types] collecting item types in module `par_stream`
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

pub fn local_def_id_to_hir_id(&self, id: LocalDefId) -> hir::HirId {
self.def_id_to_hir_id[id].unwrap()
}

This needs an MCVE

@rustbot modify labels: E-needs-mcve E-needs-bisection A-hir

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-HIRArea: The high-level intermediate representation (HIR)C-bugCategory: This is a bug.E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcE-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️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