Skip to content

Panic at diverging closure #23896

@etzih

Description

@etzih

Compiler panics, when closure marked as diverging.

I tried this code:

fn main() {
    let func = || -> ! {
        panic!("test");
    };

    func();
}

I expected to see this happen:
thread '<main>' panicked at 'test', main.rs:3

Instead, this happened:

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 'internal error: entered unreachable code', C:\bot\slave\beta-dist-rustc-win-32\build\src\librustc\middle\ty.rs:1088

Meta

rustc --version --verbose:

rustc 1.0.0-alpha.2 (522d09dfe 2015-02-19) (built 2015-02-19)
binary: rustc
commit-hash: 522d09dfecbeca1595f25ac58c6d0178bbd21d7d
commit-date: 2015-02-19
build-date: 2015-02-19
host: i686-pc-windows-gnu
release: 1.0.0-alpha.2

Backtrace:

stack backtrace:
   1: 0x62f706a7 - rt::unwind::register::h61bf8db6d89830a2xGL
   2: 0x62ec3a91 - rt::unwind::begin_unwind_inner::hb93ad32a7f9eec98PDL
   3:   0xca9420 - middle::astencode::encode_inlined_item::hbb0898a0ea507db5fla
   4:  0x100ae99 - middle::traits::select::SelectionContext<'cx, 'tcx>::closure_typer::h5815704569a77a945gS
   5:  0x1021601 - middle::ty::Substs<'tcx>.RegionEscape::has_regions_escaping_depth::hb5bbdeee412b4240Sjc
   6:  0x101fc88 - middle::ty::TraitPredicate<'tcx>.RegionEscape::has_regions_escaping_depth::h63d69ae8c3d430935oc
   7:  0x102ef1e - middle::traits::util::upcast::hbfb8155945f6c7edBuV
   8:  0x1022f3a - middle::traits::select::Option<&'o TraitObligationStack<'o, 'tcx>>.Iterator::next::h1dff8928a58b2b972bV
   9:  0x10229b9 - middle::ty::Substs<'tcx>.RegionEscape::has_regions_escaping_depth::hb5bbdeee412b4240Sjc
  10:  0x1021e94 - middle::ty::Substs<'tcx>.RegionEscape::has_regions_escaping_depth::hb5bbdeee412b4240Sjc
  11:   0xfdf089 - middle::traits::select::SelectionContext<'cx, 'tcx>::evaluate_obligation::h60ef277e877d3b76cmS
  12:  0x1a887a0 - check::method::CandidateSource...std..cmp..PartialOrd::ge::h57d5bd3c854b368aBPj
  13:  0x1abc6e6 - check::callee::CallResolution<'tcx>.DeferredCallResolution<'tcx>::resolve::hfdb248d104b05eefZGm
  14:  0x1abbb48 - check::callee::CallResolution<'tcx>.DeferredCallResolution<'tcx>::resolve::hfdb248d104b05eefZGm
  15:  0x1a98185 - check::upvar::AdjustBorrowKind<'a, 'tcx>.Visitor<'v>::visit_fn::h7731bf4220fc54b6QQk
  16:  0x1a96890 - check::upvar::SeedBorrowKind<'a, 'tcx>.Visitor<'v>::visit_fn::h7bc74301e5fbc5eePnk
  17:  0x1a95f29 - check::upvar::SeedBorrowKind<'a, 'tcx>.Visitor<'v>::visit_fn::h7bc74301e5fbc5eePnk
  18:  0x48ad2e0
  19:  0x488f770

Metadata

Metadata

Assignees

No one assigned

    Labels

    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