Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

ICE with trait_alias in Nightly: unwrap None in assemble_extension_candidates_for_trait #57676

Closed
atorstling opened this issue Jan 16, 2019 · 3 comments
Assignees
Labels
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

@atorstling
Copy link

This is the stacktrace I get:

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:355:21
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::_print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
   6: std::panicking::continue_panic_fmt
   7: rust_begin_unwind
   8: core::panicking::panic_fmt
   9: core::panicking::panic
  10: rustc_metadata::cstore_impl::provide_extern::generics_of
  11: rustc::ty::query::__query_compute::generics_of
  12: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::generics_of<'tcx>>::compute
  13: rustc::ty::context::tls::with_context
  14: rustc::dep_graph::graph::DepGraph::with_task_impl
  15: rustc::ty::context::tls::with_related_context
  16: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
  17: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_get_with
  18: rustc::ty::subst::<impl rustc::ty::List<rustc::ty::subst::Kind<'tcx>>>::for_item
  19: rustc_typeck::check::method::probe::ProbeContext::assemble_extension_candidates_for_trait
  20: rustc_typeck::check::method::probe::ProbeContext::assemble_extension_candidates_for_all_traits
  21: rustc::infer::InferCtxt::probe
  22: rustc_typeck::check::FnCtxt::suggest_ref_or_into
  23: rustc_typeck::check::demand::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::demand_coerce
  24: rustc_typeck::check::FnCtxt::check_decl_local
  25: rustc_typeck::check::FnCtxt::check_block_with_expected
  26: rustc_typeck::check::FnCtxt::check_expr_kind
  27: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_needs
  28: rustc_typeck::check::FnCtxt::check_return_expr
  29: rustc_typeck::check::check_fn
  30: rustc::ty::context::tls::with_related_context
  31: rustc::infer::InferCtxtBuilder::enter
  32: rustc_typeck::check::typeck_tables_of
  33: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::typeck_tables_of<'tcx>>::compute
  34: rustc::ty::context::tls::with_context
  35: rustc::dep_graph::graph::DepGraph::with_task_impl
  36: rustc::ty::context::tls::with_related_context
  37: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
  38: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_get_with
  39: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::ensure_query
  40: rustc::session::Session::track_errors
  41: rustc_typeck::check::typeck_item_bodies
  42: rustc::ty::query::__query_compute::typeck_item_bodies
  43: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::typeck_item_bodies<'tcx>>::compute
  44: rustc::ty::context::tls::with_context
  45: rustc::dep_graph::graph::DepGraph::with_task_impl
  46: rustc::ty::context::tls::with_related_context
  47: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
  48: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_get_with
  49: rustc_typeck::check_crate
  50: rustc::ty::context::tls::enter_context
  51: <std::thread::local::LocalKey<T>>::with
  52: rustc::ty::context::TyCtxt::create_and_enter
  53: rustc_driver::driver::compile_input
  54: rustc_driver::run_compiler_with_pool
  55: <scoped_tls::ScopedKey<T>>::set
  56: rustc_driver::run_compiler
  57: <scoped_tls::ScopedKey<T>>::set
  58: syntax::with_globals
  59: __rust_maybe_catch_panic
  60: <F as alloc::boxed::FnBox<A>>::call_box
  61: std::sys::unix::thread::Thread::new::thread_start
  62: _pthread_body
  63: _pthread_start
query stack during panic:
#0 [generics_of] processing `repro::TestAlias`
#1 [typeck_tables_of] processing `main`
#2 [typeck_item_bodies] type-checking all item bodies
end of query stack

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.33.0-nightly (2d3e909e4 2018-12-22) running on x86_64-apple-darwin

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

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

I can only repro this when using an external crate. The condition seems to be that you have to

  1. Have a compile error which triggers FnCtxt::suggest_ref_or_into, combined with
  2. Having a trait alias defined in an external crate.

I'm attaching a small cargo project which reproduces the problem.
The structure is really simple, these are the main files:

src/main.rs:

use repro;
use std::path::Path;

fn main() {
    //compile error which triggers suggest_ref_or_into
    let d: Path = Path::new(".");
}

src/lib.rs:

#![feature(trait_alias)]
trait TestAlias = core::fmt::Debug;

To repro, unzip the cargo project and run RUST_BACKTRACE=1 cargo build.

Thank you.
repro.zip

@estebank estebank added 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 16, 2019
@davidtwco davidtwco self-assigned this Jan 20, 2019
@davidtwco
Copy link
Member

Submitted #57786 with a fix for this.

@davidtwco
Copy link
Member

Looks like this was already fixed by #57502.

@atorstling
Copy link
Author

Confirmed fixed in rustc 1.33.0-nightly (7164a9f15 2019-01-21). Thank you. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

Successfully merging a pull request may close this issue.

3 participants