Skip to content

ICE when save a closure to static mut produced from closure call #23057

Closed
@dovahcrow

Description

@dovahcrow

code sample:

static mut add2: Box<FnMut() -> i32> = Box::new((||{let mut a = 0; move || {a+=1;a}})());

compiler complans:

error: internal compiler error: unexpected panic
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: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'assertion failed: fcx.inh.deferred_call_resolutions.borrow().is_empty()', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc_typeck/check/vtable.rs:268

playpen

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.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

    Issue actions