Skip to content

Rustc nightly 2017-09-19 crashes because of impl Iterator with reference Item #44956

Closed
@Boscop

Description

@Boscop
	#[inline(always)]
	pub fn changed_iter(&self) -> impl Iterator<Item = &(ParamSelector, CtrlVal)> {
		self.changed_last_frame.iter()
	}
error: internal compiler error: src\state.rs:31: src\librustc_typeck\check\mod.rs:631: escaping regions in predicate Obligation(predicate=Binder(ProjectionPredicate(ProjectionTy { substs: Slice([_]), item_def_id: DefId { krate: CrateNum(2), node: DefIndex(0:1649) => core/51d3956::iter[0]::iterator[0]::Iterator[0]::Item[0] } }, &(param::ParamSelector, f32))),depth=0)
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.22.0-nightly (325ba23d5 2017-09-19) running on x86_64-pc-windows-msvc

note: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'Box<Any>', src\librustc_errors\lib.rs:439:8
stack backtrace:
   0: _rdl_shrink_in_place
   1: std::panicking::Location::column
   2: std::panicking::Location::column
   3: std::panicking::rust_panic_with_hook
   4: <unknown>
   5: <unknown>
   6: <rustc_typeck::check::writeback::WritebackCx<'cx, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::nested_visit_map
   7: <rustc_typeck::check::writeback::WritebackCx<'cx, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::nested_visit_map
   8: <rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx> as core::ops::deref::Deref>::deref
   9: <unknown>
  10: <rustc_typeck::check::GatherLocalsVisitor<'a, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_pat
  11: <rustc_typeck::check::CheckItemTypesVisitor<'a, 'tcx> as rustc::hir::itemlikevisit::ItemLikeVisitor<'tcx>>::visit_item
  12: <rustc_typeck::check::CheckItemTypesVisitor<'a, 'tcx> as rustc::hir::itemlikevisit::ItemLikeVisitor<'tcx>>::visit_item
  13: rustc::dep_graph::graph::DepGraph::in_ignore
  14: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::try_get
  15: rustc::ty::maps::TyCtxtAt::typeck_tables_of
  16: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::typeck_tables_of
  17: <rustc_typeck::check::CheckItemTypesVisitor<'a, 'tcx> as rustc::hir::itemlikevisit::ItemLikeVisitor<'tcx>>::visit_item
  18: rustc::dep_graph::graph::DepGraph::in_ignore
  19: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_item_bodies<'tcx>>::try_get
  20: rustc::ty::maps::TyCtxtAt::typeck_item_bodies
  21: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::typeck_item_bodies
  22: rustc_typeck::check_crate
  23: <rustc_driver::derive_registrar::Finder as rustc::hir::itemlikevisit::ItemLikeVisitor<'v>>::visit_trait_item
  24: rustc_driver::driver::compile_input
  25: rustc_driver::run_compiler
  26: <unknown>
  27: _rust_maybe_catch_panic
  28: <rustc_driver::derive_registrar::Finder as rustc::hir::itemlikevisit::ItemLikeVisitor<'v>>::visit_trait_item
  29: std::sys::imp::thread::Thread::new
  30: BaseThreadInitThunk

(When I remove the '&' from Item, it gives the error "expected reference".)

Activity

Boscop

Boscop commented on Oct 1, 2017

@Boscop
Author
added
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.
C-bugCategory: This is a bug.
I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
on Oct 3, 2017
cramertj

cramertj commented on Oct 10, 2017

@cramertj
Member

impl Trait doesn't work (and isn't supposed to work) with elided lifetimes. Of course, we should display a real error instead of ICEing, but that's the problem here. It will work if you make the lifetimes explicit.

kennytm

kennytm commented on Oct 10, 2017

@kennytm
Member

Duplicate of #42479 / #43396.

pietroalbini

pietroalbini commented on Apr 3, 2018

@pietroalbini
Member

This is now fixed. Closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @kennytm@Boscop@TimNN@pietroalbini@cramertj

        Issue actions

          Rustc nightly 2017-09-19 crashes because of impl Iterator with reference Item · Issue #44956 · rust-lang/rust