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 impl_trait_in_bindings with elided lifetime #60473

pandaman64 opened this issue May 2, 2019 · 6 comments

ICE impl_trait_in_bindings with elided lifetime #60473

pandaman64 opened this issue May 2, 2019 · 6 comments


Copy link

@pandaman64 pandaman64 commented May 2, 2019


struct A<'a>(&'a ());

trait Trait<T> {

impl<T> Trait<T> for () {

fn main() {
    let x: impl Trait<A> = ();

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/
             at src/libstd/
   3: std::panicking::default_hook
             at src/libstd/
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
             at src/libstd/
   6: std::panicking::continue_panic_fmt
             at src/libstd/
   7: rust_begin_unwind
             at src/libstd/
   8: core::panicking::panic_fmt
             at src/libcore/
   9: core::panicking::panic
             at src/libcore/
  10: rustc_typeck::check::writeback::WritebackCx::visit_opaque_types
  11: rustc_typeck::check::writeback::<impl rustc_typeck::check::FnCtxt>::resolve_type_vars_in_body
  12: rustc::ty::context::GlobalCtxt::enter_local
  13: rustc_typeck::check::typeck_tables_of
  14: rustc::ty::query::__query_compute::typeck_tables_of
  15: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute
  16: rustc::dep_graph::graph::DepGraph::with_task_impl
  17: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  18: rustc_typeck::collect::checked_type_of
  19: rustc_typeck::collect::type_of
  20: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::type_of>::compute
  21: rustc::dep_graph::graph::DepGraph::with_task_impl
  22: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  23: rustc::ty::util::<impl rustc::ty::context::TyCtxt>::try_expand_impl_trait_type::OpaqueTypeExpander::expand_opaque_ty
  24: rustc::ty::util::<impl rustc::ty::context::TyCtxt>::try_expand_impl_trait_type
  25: rustc_typeck::check::check_item_type
  26: rustc::hir::map::Map::visit_item_likes_in_module
  27: rustc_typeck::check::check_mod_item_types
  28: rustc::ty::query::__query_compute::check_mod_item_types
  29: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::check_mod_item_types>::compute
  30: rustc::dep_graph::graph::DepGraph::with_task_impl
  31: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  32: rustc_typeck::check_crate::{{closure}}
  33: rustc::util::common::time
  34: rustc_typeck::check_crate
  35: rustc_interface::passes::analysis
  36: rustc::ty::query::__query_compute::analysis
  37: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::analysis>::compute
  38: rustc::dep_graph::graph::DepGraph::with_task_impl
  39: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  40: rustc::ty::context::tls::enter_global
  41: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}
  42: rustc_interface::passes::create_global_ctxt::{{closure}}
  43: rustc_interface::interface::run_compiler_in_existing_thread_pool
  44: std::thread::local::LocalKey<T>::with
  45: scoped_tls::ScopedKey<T>::set
  46: syntax::with_globals
query stack during panic:
#0 [typeck_tables_of] processing `main`
#1 [type_of] processing `main::{{opaque}}#0`
#2 [check_mod_item_types] checking item types in top-level module
#3 [analysis] running analysis passes on this crate
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:

note: rustc 1.36.0-nightly (00859e3e6 2019-04-29) running on x86_64-unknown-linux-gnu

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

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

If you give the lifetime explicitly, it compiles:

Copy link

@Centril Centril commented May 2, 2019

Unstable buggy feature: suggested P-medium;
Might also want to add to INCOMPLETE_FEATURES and P-high that aspect alone.

Copy link

@davidtwco davidtwco commented May 4, 2019

I think this is a duplicate of #60371.

Copy link

@nikomatsakis nikomatsakis commented May 9, 2019

Closing as duplicate.

Copy link

@varkor varkor commented May 10, 2019

This ICEs in a different place after #60714, hitting:

_ => bug!("open drop from non-ADT `{:?}`", ty)

Copy link

@pnkfelix pnkfelix commented May 16, 2019

triage: P-medium. Removing nomination tag.

Copy link

@Alexendoo Alexendoo commented Feb 16, 2020

Fixed by #67681

Centril added a commit to Centril/rust that referenced this issue Mar 9, 2020
Add more regression tests

Closes rust-lang#54239
Closes rust-lang#57200
Closes rust-lang#57201
Closes rust-lang#60473
Closes rust-lang#64620
Closes rust-lang#67166

r? @Centril
@bors bors closed this in 7e903f8 Mar 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

10 participants