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

Nested "impl trait" with lifetimes causing internal compiler error #46464

Closed
kazagistar opened this issue Dec 3, 2017 · 0 comments
Closed

Nested "impl trait" with lifetimes causing internal compiler error #46464

kazagistar opened this issue Dec 3, 2017 · 0 comments
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@kazagistar
Copy link

While trying to figure out how to return two iterators over a &str, the compiler crashed.

#![feature(conservative_impl_trait)]
fn parser<'a>(input: &'a str) -> impl Iterator<Item = impl Iterator<Item = i32> + 'a> + 'a {
    input.lines().map(|line| {
        line.split_whitespace().map(|cell| cell.parse().unwrap())
    })
}

Link to playground

Error message: error: internal compiler error: src\librustc\ty\subst.rs:424: Region parameter out of range when substituting in region 'a (root type=None) (index=1)

Meta

rustc --version --verbose:

rustc 1.24.0-nightly (f9b0897c5 2017-12-02)
binary: rustc
commit-hash: f9b0897c5d42a4dfa425db799073c6feb21b0178
commit-date: 2017-12-02
host: x86_64-pc-windows-msvc
release: 1.24.0-nightly
LLVM version: 4.0

Backtrace:

thread 'rustc' panicked at 'Box<Any>', src\librustc_errors\lib.rs:448:8
stack backtrace:
   0: <std::thread::ThreadId as core::fmt::Debug>::fmt
   1: <std::sync::condvar::Condvar as core::fmt::Debug>::fmt
   2: std::panicking::Location::column
   3: std::panicking::Location::column
   4: std::panicking::rust_panic_with_hook
   5: <rustc::ty::instance::InstanceDef<'tcx> as core::fmt::Debug>::fmt
   6: rustc::util::ppaux::<impl core::fmt::Debug for rustc::ty::Predicate<'tcx>>::fmt
   7: rustc::ty::maps::<impl rustc::ty::maps::queries::fully_normalize_monormophic_ty<'tcx>>::try_get
   8: rustc::ty::context::tls::span_debug
   9: rustc::session::bug_fmt
  10: rustc::session::bug_fmt
  11: <rustc::ty::subst::SubstFolder<'a, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_region
  12: rustc::ty::error::<impl rustc::ty::TyS<'tcx>>::sort_string
  13: rustc::middle::lang_items::LanguageItems::items
  14: rustc::ty::GenericPredicates::instantiate_own
  15: rustc::ty::GenericPredicates::instantiate
  16: <unknown>
  17: <rustc_typeck::check::upvar::InferBorrowKind<'a, 'gcx, 'tcx> as rustc::middle::expr_use_visitor::Delegate<'tcx>>::mutate
  18: <unknown>
  19: <rustc_typeck::check::GatherLocalsVisitor<'a, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_pat
  20: <rustc_typeck::variance::terms::InferredIndex as core::fmt::Debug>::fmt
  21: <rustc_typeck::check::callee::DeferredCallResolution<'gcx, 'tcx> as core::fmt::Debug>::fmt
  22: <rustc_typeck::check::CheckItemTypesVisitor<'a, 'tcx> as rustc::hir::itemlikevisit::ItemLikeVisitor<'tcx>>::visit_item
  23: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::ensure
  24: rustc::dep_graph::graph::DepGraph::in_ignore
  25: rustc::util::ppaux::<impl core::fmt::Debug for rustc::ty::Predicate<'tcx>>::fmt
  26: <rustc::ty::_match::Match<'a, 'gcx, 'tcx> as rustc::ty::relate::TypeRelation<'a, 'gcx, 'tcx>>::tys
  27: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::ensure
  28: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::try_get
  29: rustc::ty::maps::TyCtxtAt::typeck_tables_of
  30: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::ensure
  31: <rustc_typeck::check::upvar::InferBorrowKind<'a, 'gcx, 'tcx> as rustc::middle::expr_use_visitor::Delegate<'tcx>>::mutate
  32: <rustc_typeck::check::CheckItemTypesVisitor<'a, 'tcx> as rustc::hir::itemlikevisit::ItemLikeVisitor<'tcx>>::visit_item
  33: rustc::dep_graph::graph::DepGraph::in_ignore
  34: rustc::util::ppaux::<impl core::fmt::Debug for rustc::ty::Predicate<'tcx>>::fmt
  35: <rustc::ty::_match::Match<'a, 'gcx, 'tcx> as rustc::ty::relate::TypeRelation<'a, 'gcx, 'tcx>>::tys
  36: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_item_bodies<'tcx>>::ensure
  37: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_item_bodies<'tcx>>::try_get
  38: rustc::ty::maps::TyCtxtAt::typeck_item_bodies
  39: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::typeck_item_bodies
  40: rustc_typeck::check_crate
  41: <rustc_driver::derive_registrar::Finder as rustc::hir::itemlikevisit::ItemLikeVisitor<'v>>::visit_impl_item
  42: <rustc_driver::derive_registrar::Finder as rustc::hir::itemlikevisit::ItemLikeVisitor<'v>>::visit_impl_item
  43: <rustc_driver::profile::trace::Query as core::fmt::Debug>::fmt
  44: rustc_driver::driver::compile_input
  45: rustc_driver::run_compiler
  46: rustc_driver::driver::build_output_filenames
  47: _rust_maybe_catch_panic
  48: <rustc_driver::profile::trace::Query as core::fmt::Debug>::fmt
  49: <std::sync::condvar::Condvar as core::fmt::Debug>::fmt
  50: std::sys::windows::thread::Thread::new
  51: BaseThreadInitThunk
@TimNN TimNN added A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Dec 5, 2017
Manishearth added a commit to Manishearth/rust that referenced this issue Feb 23, 2018
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. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

2 participants