Repository: rust
Issue: thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/librustc_typeck/check/intrinsic.rs:288:42
Labels: I-ICE,T-compiler,C-bug,requires-nightly,S-needs-repro

This happened while trying to build libstd (outside of bootstrap) for hexagon-unknown-linux-musl.  Not sure if `xbuild` is the appropriate convention but I saw it used in libc crate's CI and assumed it might be worth a try w/libstd.

```
cd src/libstd
RUST_BACKTRACE=1 cargo +nightly xbuild -vv --no-default-features --target hexagon-unknown-linux-musl

...

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/librustc_typeck/check/intrinsic.rs:288:42
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1076
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1537
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   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:198
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:218
  10: rustc_driver::report_ice
  11: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:490
  12: rust_begin_unwind
             at src/libstd/panicking.rs:388
  13: core::panicking::panic_fmt
             at src/libcore/panicking.rs:101
  14: core::panicking::panic
             at src/libcore/panicking.rs:56
  15: rustc_typeck::check::intrinsic::check_intrinsic_type
  16: rustc_typeck::check::check_item_type
  17: rustc_middle::hir::map::Map::visit_item_likes_in_module
  18: rustc_typeck::check::check_mod_item_types
  19: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::check_mod_item_types>::compute
  20: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  21: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  22: rustc_data_structures::stack::ensure_sufficient_stack
  23: rustc_query_system::query::plumbing::get_query_impl
  24: rustc_query_system::query::plumbing::ensure_query_impl
  25: rustc_session::utils::<impl rustc_session::session::Session>::time
  26: rustc_typeck::check_crate
  27: rustc_interface::passes::analysis
  28: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
  29: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  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::get_query_impl
  33: rustc_middle::ty::context::tls::enter_global
  34: rustc_interface::interface::run_compiler_in_existing_thread_pool
  35: rustc_ast::attr::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.45.0-nightly (56daaf669 2020-06-03) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debug-assertions=off -C overflow-checks=on -C incremental --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [check_mod_item_types] checking item types in module `intrinsics`
#1 [analysis] running analysis passes on this crate
end of query stack

```