Skip to content

ICE:cannot relate bound region #17165

Closed
Closed
@hebiyan

Description

@hebiyan

'rustc -v' output:
rustc 0.12.0-pre (641b1980a 2014-09-09 04:26:18 +0000)

os:
Mac OS X 10.9.4

'uname -a' output:

Darwin server.gideon001.private 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun  3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64

code:

fn main () {
    let addf: <'r>|int|:'r -> Box<|int|:'r -> int> = 
        |n:int|  {box |m:int| -> int {n + m }};

    println!("{}", (*addf(2))(3));
}

RUST_BACKTRACE=1 rustc output:

cl.rs:4:9: 4:47 error: internal compiler error: cannot relate bound region: ReLateBound (10, BrNamed (syntax::ast::DefId{krate: 0u32, node: 26u32}, 'r)) <= ReInfer (0)
cl.rs:4         |n:int|  {box |m:int| -> int {n + m }};
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'Box<Any>', /Users/gideon/tools/rust/rust/src/libsyntax/ast_util.rs:776

stack backtrace:
   1:        0x110d45925 - rt::backtrace::imp::write::hc34efde930f36017Lhr
   2:        0x110d48c61 - failure::on_fail::h3bc40b5494fc9081Fyr
   3:        0x110ffba35 - unwind::begin_unwind_inner::h82cdbb3cd9ec0b01b0d
   4:        0x1103c2c6a - unwind::begin_unwind::h3453961218879215225
   5:        0x1103c2be5 - diagnostic::SpanHandler::span_bug::h1b86fed0ce30aee8YaF
   6:        0x10d8e49c7 - driver::session::Session::span_bug::h64074688fe14108d1IE
   7:        0x10de03e21 - middle::typeck::infer::region_inference::RegionVarBindings<'a, 'tcx>::make_subregion::h60507627917bb1c6jUc
   8:        0x10de1348f - middle::typeck::infer::sub::Sub<'f, 'tcx>.Combine<'tcx>::regions::h8af2cb6ad62249fefAf
   9:        0x10de13115 - middle::typeck::infer::sub::Sub<'f, 'tcx>.Combine<'tcx>::contraregions::hd6337c74f4ce1730Fzf
  10:        0x10ddb3cc5 - middle::typeck::infer::sub::Sub<'f, 'tcx>.Combine<'tcx>::tys::h4ff6780852b0589dNIf
  11:        0x10ddb1750 - middle::typeck::infer::coercion::Coerce<'f, 'tcx>::subtype::h3ece1fef911cabeeMn6
  12:        0x10ddb150c - middle::typeck::infer::coercion::Coerce<'f, 'tcx>::coerce_borrowed_fn::h969fec4a98356fe5h76
  13:        0x10ddb12e1 - middle::typeck::infer::coercion::Coerce<'f, 'tcx>::tys::closure.134706
  14:        0x10ddae4c4 - middle::typeck::infer::coercion::Coerce<'f, 'tcx>::unpack_actual_value::h948805772714329226
  15:        0x10ddadf79 - middle::typeck::infer::coercion::Coerce<'f, 'tcx>::tys::hb38bc87449217190If6
  16:        0x10de21648 - middle::typeck::infer::mk_coercety::closure.136784
  17:        0x10de212d0 - middle::typeck::infer::InferCtxt<'a, 'tcx>::commit_if_ok::closure.136776
  18:        0x10de21147 - middle::typeck::infer::InferCtxt<'a, 'tcx>::commit_unconditionally::h11340877979196374766
  19:        0x10dd4c305 - middle::typeck::infer::mk_coercety::hc4de794711c1d371Bgi
  20:        0x10dcf3565 - middle::typeck::check::FnCtxt<'a, 'tcx>::mk_assignty::h476edb1f6652be36yTY
  21:        0x10dcf33bd - middle::typeck::check::demand::coerce::h7c31b43dc8bb8462mxT
  22:        0x10dd5bc6a - middle::typeck::check::check_expr_coercable_to_type::closure.133678
  23:        0x10dd543ef - middle::typeck::check::check_expr_with_unifier::h6d5b3dc20f73aee9F3Z
  24:        0x10dda8474 - middle::typeck::check::check_decl_local::h5a935f957a31a756w61
  25:        0x10dda86c8 - middle::typeck::check::check_stmt::h372cfadc360693a0E81
  26:        0x10dd16662 - middle::typeck::check::check_block_with_expected::h22fe190983b7dfe2Rc2
  27:        0x10dd11d58 - middle::typeck::check::check_fn::hb51a901c65978ab9OLW
  28:        0x10dd112c9 - middle::typeck::check::check_bare_fn::h3d757c7ca707a846sAW
  29:        0x10dd09f8d - middle::typeck::check::check_item::h13627fd0014f8964mgX
  30:        0x10dd110ad - middle::typeck::check::check_item_types::h56a54a78d1f84672rzW
  31:        0x10d740b86 - util::common::time::h6774358895183961009
  32:        0x10df221f8 - middle::typeck::check_crate::h79d3f57e66bdaf51xgp
  33:        0x10dfde766 - driver::driver::phase_3_run_analysis_passes::h821dbd7bfc00cf7e6YD
  34:        0x10dfd94b2 - driver::driver::compile_input::h7817fa347452fba6JKD
  35:        0x10e064a0a - driver::run_compiler::ha557cce5753da6b01CH
  36:        0x10e062e16 - driver::main_args::closure.148073
  37:        0x10d758d6b - task::TaskBuilder<S>::try_future::closure.100105
  38:        0x10d758c73 - task::TaskBuilder<S>::spawn_internal::closure.100076
  39:        0x110bcd6cd - task::spawn_opts::closure.8474
  40:        0x11105e1cc - rust_try_inner
  41:        0x11105e1b6 - rust_try
  42:        0x110ff8ed7 - unwind::try::h083fe44507311ba0lOd
  43:        0x110ff8d4c - task::Task::run::h91e4f0552d7b8b33L0c
  44:        0x110bcd522 - task::spawn_opts::closure.8413
  45:        0x110ffa97a - thread::thread_start::h4f6e4374d46c14dbSld
  46:     0x7fff8bf53899 - _pthread_body
  47:     0x7fff8bf5372a - _pthread_struct_init

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lifetimesArea: Lifetimes / regionsE-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