Skip to content

[ICE] Compiler panics when trying to return impl Iterator<Item = &a> #41185

Closed
@skeleten

Description

@skeleten

Hi,
I've run into an ICE while trying to return an iterator over references, using the conservative_impl_trait feature.
This is a short example producing the error:
https://play.rust-lang.org/?gist=35775bb4f3cc3a143e0c46a433580b94&version=nightly&backtrace=1

The backtrace it produces is

   0: rustc::session::opt_span_bug_fmt::{{closure}}
   1: rustc::session::span_bug_fmt
   2: rustc_typeck::check::FnCtxt::register_predicate
   3: <rustc::ty::fold::BottomUpFolder<'a, 'gcx, 'tcx, F> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty
   4: rustc_typeck::check::check_fn
   5: rustc_typeck::check::typeck_tables
   6: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables<'tcx>>::try_get
   7: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables<'tcx>>::get
   8: rustc::ty::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::item_tables
   9: rustc_typeck::check::typeck_item_bodies
  10: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_item_bodies<'tcx>>::try_get
  11: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_item_bodies<'tcx>>::get
  12: rustc_typeck::check_crate
  13: rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}
  14: rustc::ty::context::TyCtxt::create_and_enter
  15: rustc_driver::driver::phase_3_run_analysis_passes
  16: rustc_driver::driver::compile_input
  17: rustc_driver::run_compiler
  18: std::panicking::try::do_call
  19: __rust_maybe_catch_panic
             at /checkout/src/libpanic_unwind/lib.rs:98
  20: <F as alloc::boxed::FnBox<A>>::call_box
  21: std::sys::imp::thread::Thread::new::thread_start
             at /checkout/src/liballoc/boxed.rs:650
             at /checkout/src/libstd/sys_common/thread.rs:21
             at /checkout/src/libstd/sys/unix/thread.rs:84
  22: start_thread
  23: clone

My rustc --version --verbose is

rustc 1.17.0-nightly (fd182c401 2017-03-13)
binary: rustc
commit-hash: fd182c4010b5aee72d070b15e90c98cb0fdc3776
commit-date: 2017-03-13
host: x86_64-unknown-linux-gnu
release: 1.17.0-nightly
LLVM version: 3.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions