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

Broken MIR impl_trait_in_bindings ICE #57201

DutchGhost opened this Issue Dec 29, 2018 · 1 comment


None yet
5 participants
Copy link

DutchGhost commented Dec 29, 2018


fn bug<'a, 'b, T>()
    'a: 'b,
    let f: &impl Fn(&'a T) -> &'b T = &|x| x;

fn main() {}
error: internal compiler error: broken MIR in DefId(0/0:3 ~ playground[1f65]::bug[0]) (_1 = &(*_2)): bad assignment (&impl std::ops::Fn<(&T,)> = &[closure@src/ 7:45]): NoSolution
 --> src/
7 |     let f: &impl Fn(&'a T) -> &'b T = &|x| x;
  |                                       ^^^^^^

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/
             at src/libstd/
   3: std::panicking::default_hook
             at src/libstd/
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
             at src/libstd/
   6: std::panicking::begin_panic
   7: <rustc_errors::Handler as core::ops::drop::Drop>::drop
   8: core::ptr::real_drop_in_place
   9: core::ptr::real_drop_in_place
  10: core::ptr::real_drop_in_place
  11: <scoped_tls::ScopedKey<T>>::set
query stack during panic:
end of query stack

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report:

note: rustc 1.33.0-nightly (60e825389 2018-12-28) running on x86_64-unknown-linux-gnu

note: compiler flags: -C opt-level=3 -C codegen-units=1 --crate-type bin

note: some of the compiler flags provided by cargo are hidden

ICE's on both 2015 and 2018.

This is verry similar to #57200, (notice the & in front of the type and closure here), yet a verry different ICE message.


This comment has been minimized.

Copy link

gralpli commented Dec 31, 2018

Came across what looks to be the same ICE today and found a simpler example:


fn main() {
    let a = vec![1, 2, 3];
    let b: Box<impl Iterator> = Box::new(a.iter());
error: internal compiler error: broken MIR in DefId(0/0:3 ~ playground[6d86]::main[0]) (Terminator { source_info: SourceInfo { span: src/ 6:51, scope: scope[1] }, kind: _5 = const <std::boxed::Box<T>>::new(move _6) -> [return: bb9, unwind: bb7] }): call dest mismatch (std::boxed::Box<impl std::iter::Iterator> <- std::boxed::Box<std::slice::Iter<'_, i32>>): NoSolution
 --> src/
6 |     let b: Box<impl Iterator> = Box::new(a.iter());
  |                                                 ^

@matthewjasper matthewjasper self-assigned this Jan 23, 2019

@nikomatsakis nikomatsakis removed the A-NLL label Jan 23, 2019

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