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

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

Closed
Boscop opened this issue Oct 1, 2017 · 4 comments
Closed

Comments

@Boscop
Copy link

@Boscop Boscop commented Oct 1, 2017

	#[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".)

@cramertj
Copy link
Member

@cramertj cramertj commented Oct 10, 2017

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
Copy link
Member

@kennytm kennytm commented Oct 10, 2017

Duplicate of #42479 / #43396.

@pietroalbini
Copy link
Member

@pietroalbini pietroalbini commented Apr 3, 2018

This is now fixed. Closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants