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

Closed
pandaman64 opened this issue May 2, 2019 · 6 comments · Fixed by #69842
Closed

ICE impl_trait_in_bindings with elided lifetime #60473

pandaman64 opened this issue May 2, 2019 · 6 comments · Fixed by #69842
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. F-impl_trait_in_bindings `#![feature(impl_trait_in_bindings)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@pandaman64
Copy link

#![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

@matthewjasper matthewjasper added A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels May 2, 2019
@Centril Centril added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. I-nominated labels May 2, 2019
@Centril
Copy link
Contributor

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.

@davidtwco
Copy link
Member

I think this is a duplicate of #60371.

@nikomatsakis
Copy link
Contributor

Closing as duplicate.

@varkor
Copy link
Member

varkor commented May 10, 2019

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

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

@pnkfelix
Copy link
Member

triage: P-medium. Removing nomination tag.

@pnkfelix pnkfelix added P-medium Medium priority and removed I-nominated labels May 16, 2019
@Centril Centril added F-impl_trait_in_bindings `#![feature(impl_trait_in_bindings)]` requires-nightly This issue requires a nightly compiler in some way. labels Jul 28, 2019
@jonas-schievink jonas-schievink added the C-bug Category: This is a bug. label Aug 6, 2019
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Oct 15, 2019
@Alexendoo
Copy link
Member

Fixed by #67681

@Alexendoo Alexendoo added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Feb 16, 2020
Centril added a commit to Centril/rust that referenced this issue Mar 9, 2020
@bors bors closed this as completed in 7e903f8 Mar 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. F-impl_trait_in_bindings `#![feature(impl_trait_in_bindings)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority requires-nightly This issue requires a nightly compiler in some way. 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.

10 participants