Skip to content

ICE with generators #51624

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

Closed
tuxmark5 opened this issue Jun 18, 2018 · 2 comments
Closed

ICE with generators #51624

tuxmark5 opened this issue Jun 18, 2018 · 2 comments
Labels
A-coroutines Area: Coroutines A-trait-system Area: Trait system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@tuxmark5
Copy link

This snippet causes rustc to ICE:

#![feature(generators)]
#![feature(generator_trait)]

use std::marker::PhantomData;
use std::ops::Generator;

trait Trait: 'static { }

struct Index<T: ?Sized = dyn Trait> {
  id: i32, ty: PhantomData<T>
}

fn new_index() -> Index { Index { id: 10, ty: PhantomData } }

fn with_ctx<F: FnOnce(&mut i32) -> T, T>(f: F) -> T {
  let mut ctx = 123; 
  f(&mut ctx)
}

fn accept_gen<G: Generator>(g: G) { }

fn main() {
  accept_gen(static move || {
    let poll = with_ctx(|ctx| new_index());
    yield 20;
  });
}

Version: rustc 1.28.0-nightly (86a8f1a 2018-06-17)

Partial error message:

thread 'main' panicked at 'assertion failed: !value.has_escaping_regions()', librustc/ty/sty.rs:745:9
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:211
   3: std::panicking::default_hook
             at libstd/panicking.rs:227
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:515
   6: std::panicking::begin_panic
   7: rustc::ty::wf::WfPredicates::compute
   8: rustc::ty::wf::obligations
   9: <rustc::traits::fulfill::FulfillmentContext<'tcx> as rustc::traits::engine::TraitEngine<'tcx>>::select_where_possible
  10: <rustc::traits::fulfill::FulfillmentContext<'tcx> as rustc::traits::engine::TraitEngine<'tcx>>::select_all_or_error
  11: rustc_typeck::check::FnCtxt::select_all_obligations_or_error
...
@estebank estebank added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-trait-system Area: Trait system A-coroutines Area: Coroutines labels Jun 22, 2018
@Zoxc
Copy link
Contributor

Zoxc commented Jul 2, 2018

Might be a duplicate of #49537

@Nemo157
Copy link
Member

Nemo157 commented Apr 4, 2019

This doesn't appear to ICE anymore.

@oli-obk oli-obk closed this as completed Apr 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-coroutines Area: Coroutines A-trait-system Area: Trait system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

5 participants