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

Open
pandaman64 opened this issue May 2, 2019 · 5 comments

Comments

Projects
None yet
7 participants
@pandaman64
Copy link

commented May 2, 2019

#![feature(impl_trait_in_bindings)]

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

trait Trait<T> {
}

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

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

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:347:21
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/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::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: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

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

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=540971beb17a2f712b41a5a5e8888f51

If you give the lifetime explicitly, it compiles:
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=ccd7cdc4e4d0e3952f518070fae7fba8

@Centril

This comment has been minimized.

Copy link
Member

commented May 2, 2019

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

@davidtwco

This comment has been minimized.

Copy link
Member

commented May 4, 2019

I think this is a duplicate of #60371.

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

commented May 9, 2019

Closing as duplicate.

@varkor

This comment has been minimized.

Copy link
Member

commented May 10, 2019

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

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

@pnkfelix

This comment has been minimized.

Copy link
Member

commented May 16, 2019

triage: P-medium. Removing nomination tag.

@pnkfelix pnkfelix added P-medium and removed I-nominated labels May 16, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.