Skip to content
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

rustc tried to unwrap None (only nightly) #60275

Closed
EEVV opened this issue Apr 25, 2019 · 0 comments · Fixed by #60285
Closed

rustc tried to unwrap None (only nightly) #60275

EEVV opened this issue Apr 25, 2019 · 0 comments · Fixed by #60285
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@EEVV
Copy link

EEVV commented Apr 25, 2019

While using the rand crate I accidentally misread rand::random::<f64>() as rand::random<f64>() and the compiler responded with an error and also a panic.

extern crate rand;

fn main() {
    let random = rand::random<f64>();
}

Meta

rustc --version --verbose:

rustc 1.36.0-nightly (e938c2b9a 2019-04-23)
binary: rustc
commit-hash: e938c2b9aae7e0c37c382e4e22bdc360e9a4f0b6
commit-date: 2019-04-23
host: x86_64-unknown-linux-gnu
release: 1.36.0-nightly
LLVM version: 8.0

(also fails on playground): https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=229b9583f1b448072b0a182bb75f7900

Backtrace:

stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:59
             at src/libstd/panicking.rs:197
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:211
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:478
   6: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:381
   7: rust_begin_unwind
             at src/libstd/panicking.rs:308
   8: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
   9: core::panicking::panic
             at src/libcore/panicking.rs:49
  10: rustc_typeck::check::has_typeck_tables
  11: rustc::ty::query::__query_compute::has_typeck_tables
  12: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::has_typeck_tables>::compute
  13: rustc::dep_graph::graph::DepGraph::with_task_impl
  14: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  15: rustc_typeck::check::op::<impl rustc_typeck::check::FnCtxt>::add_type_neq_err_label
  16: rustc_typeck::check::op::<impl rustc_typeck::check::FnCtxt>::check_overloaded_binop
  17: rustc_typeck::check::op::<impl rustc_typeck::check::FnCtxt>::check_binop
  18: rustc_typeck::check::FnCtxt::check_expr_kind
  19: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_needs
  20: rustc_typeck::check::op::<impl rustc_typeck::check::FnCtxt>::check_overloaded_binop
  21: rustc_typeck::check::op::<impl rustc_typeck::check::FnCtxt>::check_binop
  22: rustc_typeck::check::FnCtxt::check_expr_kind
  23: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_needs
  24: rustc_typeck::check::FnCtxt::check_decl_initializer
  25: rustc_typeck::check::FnCtxt::check_decl_local
  26: rustc_typeck::check::FnCtxt::check_stmt
  27: rustc_typeck::check::FnCtxt::check_block_with_expected
  28: rustc_typeck::check::FnCtxt::check_expr_kind
  29: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_needs
  30: rustc_typeck::check::FnCtxt::check_return_expr
  31: rustc_typeck::check::check_fn
  32: rustc::ty::context::GlobalCtxt::enter_local
  33: rustc_typeck::check::typeck_tables_of
  34: rustc::ty::query::__query_compute::typeck_tables_of
  35: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute
  36: rustc::dep_graph::graph::DepGraph::with_task_impl
  37: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  38: rustc::ty::<impl rustc::ty::context::TyCtxt>::par_body_owners
  39: rustc_typeck::check::typeck_item_bodies
  40: rustc::ty::query::__query_compute::typeck_item_bodies
  41: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_item_bodies>::compute
  42: rustc::dep_graph::graph::DepGraph::with_task_impl
  43: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  44: rustc::util::common::time
  45: rustc_typeck::check_crate
  46: rustc_interface::passes::analysis
  47: rustc::ty::query::__query_compute::analysis
  48: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::analysis>::compute
  49: rustc::dep_graph::graph::DepGraph::with_task_impl
  50: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  51: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}
  52: rustc_interface::passes::create_global_ctxt::{{closure}}
  53: rustc_interface::passes::BoxedGlobalCtxt::enter
  54: rustc_interface::interface::run_compiler_in_existing_thread_pool
  55: std::thread::local::LocalKey<T>::with
  56: scoped_tls::ScopedKey<T>::set
  57: syntax::with_globals
query stack during panic:
#0 [has_typeck_tables] processing `rand::random`
#1 [typeck_tables_of] processing `main`
#2 [typeck_item_bodies] type-checking all item bodies
#3 [analysis] running analysis passes on this crate
end of query stack
@jonas-schievink jonas-schievink 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. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. I-nominated labels Apr 25, 2019
Centril added a commit to Centril/rust that referenced this issue Apr 25, 2019
Do not ICE when checking types against foreign fn

Fix rust-lang#60275.
Centril added a commit to Centril/rust that referenced this issue Apr 25, 2019
Do not ICE when checking types against foreign fn

Fix rust-lang#60275.
Centril added a commit to Centril/rust that referenced this issue Apr 26, 2019
Do not ICE when checking types against foreign fn

Fix rust-lang#60275.
# 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) ❄️ regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants