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

ICE with boxed closure includes argument with lifetime and Drop #25389

Closed
seanmonstar opened this issue May 13, 2015 · 1 comment
Closed

ICE with boxed closure includes argument with lifetime and Drop #25389

seanmonstar opened this issue May 13, 2015 · 1 comment
Labels
A-closures Area: Closures (`|…| { … }`) A-destructors Area: Destructors (`Drop`, …) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@seanmonstar
Copy link
Contributor

Code:

struct Foo<'a> {
    a: &'a str
}

impl<'a> Drop for Foo<'a> {
    fn drop(&mut self) {}
}

fn main() {
    let _: Vec<Box<Fn(Foo)>> = Vec::new();
}

Error:

error: internal compiler error: cannot relate bound region: ReScope(DestructionScope(26)) <= ReLateBound(DebruijnIndex { depth: 1 }, BrAnon(0))

Backtrace using 1.0.0-beta.5 (also occurs with rustc 1.1.0-nightly (c2b30b86d 2015-05-12) (built 2015-05-13)):

thread 'rustc' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/beta-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:149

stack backtrace:
   1:     0x7f4ed2c18429 - sys::backtrace::write::h3fdf06e7a8dd7bced4r
   2:     0x7f4ed2c20136 - panicking::on_panic::hdc3f6d7788894b93jrw
   3:     0x7f4ed2be3442 - rt::unwind::begin_unwind_inner::h93ec8cb6029f2822t6v
   4:     0x7f4ed01ae43d - rt::unwind::begin_unwind::h13038079570089827110
   5:     0x7f4ed01ae3d2 - diagnostic::SpanHandler::span_bug::h81555737e15010e3EqB
   6:     0x7f4ed0c8079e - middle::infer::region_inference::RegionVarBindings<'a, 'tcx>::make_subregion::ha14bc637a5d82b0dtiv
   7:     0x7f4ed0c9ad2d - middle::infer::mk_subr::h5555b742f1f8903eXWy
   8:     0x7f4ed19c6524 - check::regionck::type_must_outlive::h45e3ba7d488e34d2QBe
   9:     0x7f4ed19c4489 - check::dropck::iterate_over_potentially_unsafe_regions_in_type::h582cacd73f4ee5f6CDa
  10:     0x7f4ed19c45e4 - check::dropck::iterate_over_potentially_unsafe_regions_in_type::h582cacd73f4ee5f6CDa
  11:     0x7f4ed19c45e4 - check::dropck::iterate_over_potentially_unsafe_regions_in_type::h582cacd73f4ee5f6CDa
  12:     0x7f4ed19c45e4 - check::dropck::iterate_over_potentially_unsafe_regions_in_type::h582cacd73f4ee5f6CDa
  13:     0x7f4ed19c3218 - check::dropck::check_safety_of_destructor_if_necessary::hd55366388bca82c5Mxa
  14:     0x7f4ed19f508d - check::regionck::check_safety_of_rvalue_destructor_if_necessary::h34584ca2e6bb57b0gXd
  15:     0x7f4ed19eebcf - check::regionck::visit_expr::h410fd5fb32b6f6c0Yhd
  16:     0x7f4ed19ecd7d - check::regionck::Rcx<'a, 'tcx>::visit_fn_body::h8dbb31ea8fa0d01apUc
  17:     0x7f4ed1a668a6 - check::check_bare_fn::he66bf0548da8b8d1twn
  18:     0x7f4ed1a6f09c - check::check_method_body::h5b78b6a12b2b5463Y7n
  19:     0x7f4ed1a64568 - check::CheckItemBodiesVisitor<'a, 'tcx>.Visitor<'tcx>::visit_item::h5534b4c58b22cf23wtn
  20:     0x7f4ed1b286aa - check_crate::closure.38021
  21:     0x7f4ed1b23a40 - check_crate::h44f7d6f01042e613XcC
  22:     0x7f4ed315bc88 - driver::phase_3_run_analysis_passes::h071f1f038f4270canGa
  23:     0x7f4ed313cd85 - driver::compile_input::hc5c2173550d25b21Qba
  24:     0x7f4ed31fe551 - run_compiler::h5fd7a3cba8c0dcd3z4b
  25:     0x7f4ed31fc1a2 - boxed::F.FnBox<A>::call_box::h13268679164253669965
  26:     0x7f4ed31fb6d9 - rt::unwind::try::try_fn::h1333595601538020842
  27:     0x7f4ed2c92aa8 - rust_try_inner
  28:     0x7f4ed2c92a95 - rust_try
  29:     0x7f4ed31fb988 - boxed::F.FnBox<A>::call_box::h18060233810932446010
  30:     0x7f4ed2c1f021 - sys::thread::create::thread_start::h7002e49f5ed4f198aqv
  31:     0x7f4ecd4a1181 - start_thread
  32:     0x7f4ed286947c - __clone
  33:                0x0 - <unknown>

Playpen: http://is.gd/s4uWQW

@seanmonstar
Copy link
Contributor Author

tag ICE, destructors, closures?

@sfackler sfackler added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-destructors Area: Destructors (`Drop`, …) A-closures Area: Closures (`|…| { … }`) labels May 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-closures Area: Closures (`|…| { … }`) A-destructors Area: Destructors (`Drop`, …) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

2 participants