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 when using a lifetime parameter in a where clause #16564

Closed
sfackler opened this issue Aug 17, 2014 · 2 comments · Fixed by #16616
Closed

ICE when using a lifetime parameter in a where clause #16564

sfackler opened this issue Aug 17, 2014 · 2 comments · Fixed by #16616
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@sfackler
Copy link
Member

fn foo<'a, I>(mut it: I) where I: Iterator<&'a int> {}

fn main() {
    foo([1i, 2].iter());
}
test.rs:4:5: 4:8 error: internal compiler error: cannot relate bound region: ReLateBound(4, BrNamed(syntax::ast::DefId{krate: 0u32, node: 11u32}, 'a)) <= ReInfer(102)
test.rs:4     foo([1i, 2].iter());
              ^~~
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>', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/ast_util.rs:791

stack backtrace:
   1:     0x7f0750d2ba60 - rt::backtrace::imp::write::h915f70b87af05b8cmxr
   2:     0x7f0750d2eb00 - failure::on_fail::h3bfbb66e809f10e63Sr
   3:     0x7f0751505ee0 - unwind::begin_unwind_inner::hdda436f89ca4acd6Zhe
   4:     0x7f074f9450b0 - unwind::begin_unwind::h9125269610435311192
   5:     0x7f074f945000 - diagnostic::SpanHandler::span_bug::hc244fe505535bd433uF
   6:     0x7f0751abd6d0 - driver::session::Session::span_bug::h5df75a538dc01b06ZNA
   7:     0x7f0751f97630 - middle::typeck::infer::region_inference::RegionVarBindings<'a>::make_subregion::h966bcd69e331f8c59W5
   8:     0x7f0751f7d890 - middle::typeck::infer::sub::Sub<'f>.Combine::regions::h03568e631b5674497r8
   9:     0x7f0751f7dc00 - middle::typeck::infer::sub::Sub<'f>.Combine::contraregions::h13956ce561fb5850xr8
  10:     0x7f0751f675a0 - middle::typeck::infer::sub::Sub<'f>.Combine::tys::h8728d19bb6506359xA8
  11:     0x7f0751fabfb0 - middle::typeck::infer::combine::eq_tys::closure.125549
  12:     0x7f0751f64bf0 - middle::typeck::infer::InferCtxt<'a>::try::h8077952307852343475
  13:     0x7f0751fabe30 - middle::typeck::infer::combine::eq_tys::h14537646206334856932
  14:     0x7f0751faa200 - middle::typeck::infer::combine::Combine::substs::h4709403821174409647
  15:     0x7f0751fd6b80 - middle::typeck::infer::mk_sub_trait_refs::closure.126315
  16:     0x7f0751fd68b0 - middle::typeck::infer::InferCtxt<'a>::commit_if_ok::closure.126307
  17:     0x7f0751fd6700 - middle::typeck::infer::InferCtxt<'a>::commit_unconditionally::h4157984422034910170
  18:     0x7f0751e5a3b0 - middle::typeck::infer::mk_sub_trait_refs::hee6f3e0ab4e569e6bxd
  19:     0x7f0751e59d40 - middle::typeck::check::vtable::relate_trait_refs::hf00ee302275f83ffaJL
  20:     0x7f0751e5b050 - middle::typeck::check::vtable::search_for_vtable::h62cb709e3558328eo1L
  21:     0x7f0751e58160 - middle::typeck::check::vtable::lookup_vtables_for_param::closure.121712
  22:     0x7f0751e1d090 - middle::ty::each_bound_trait_and_supertraits::hf6aa2b1412717287BOI
  23:     0x7f0751e57be0 - middle::typeck::check::vtable::lookup_vtables_for_param::h2f3e3aa0d87321fcEuL
  24:     0x7f0751e55a20 - middle::typeck::check::vtable::lookup_vtables::h2b52d443aea8bc88GoL
  25:     0x7f0751e65650 - middle::typeck::check::vtable::early_resolve_expr::closure.121862
  26:     0x7f0751e654c0 - middle::typeck::check::FnCtxt<'a>::opt_node_ty_substs::h73a61f1da9fe6172PXU
  27:     0x7f0751e61970 - middle::typeck::check::vtable::early_resolve_expr::h74a603ae5b2dd414lnM
  28:     0x7f0751f002c0 - middle::typeck::check::check_argument_types::ha6ecc6e8415348b0xmV
  29:     0x7f0751f02960 - middle::typeck::check::check_expr_with_unifier::h7f07d1d05896e44fSXV
  30:     0x7f0751f616a0 - middle::typeck::check::check_stmt::h139e8f1cea959a0502X
  31:     0x7f0751ecb610 - middle::typeck::check::check_block_with_expected::h32b2d067c318c94ad7X
  32:     0x7f0751ec73a0 - middle::typeck::check::check_fn::h11b95bd8147ec11f3dT
  33:     0x7f0751ec70c0 - middle::typeck::check::check_bare_fn::h0b6077c308262260I2S
  34:     0x7f0751ec0220 - middle::typeck::check::check_item::habadeb79d560f4d0QBT
  35:     0x7f0751ec6ec0 - middle::typeck::check::check_item_types::h63a60aa7829eefedZ1S
  36:     0x7f07518df300 - util::common::time::h2328891505148832078
  37:     0x7f07520d4b50 - middle::typeck::check_crate::h266f9d5cd5ece381vFk
  38:     0x7f07521a2180 - driver::driver::phase_3_run_analysis_passes::h53949348bfafe8ffJfz
  39:     0x7f075219d2c0 - driver::driver::compile_input::hd2d14ec13437de9cP1y
  40:     0x7f075224a150 - driver::run_compiler::he03a385a4310d17aJzC
  41:     0x7f075224a060 - driver::main_args::closure.137214
  42:     0x7f075225ca30 - task::TaskBuilder<S>::try_future::closure.138375
  43:     0x7f075225c830 - task::TaskBuilder<S>::spawn_internal::closure.138352
  44:     0x7f0752cabb30 - task::spawn_opts::closure.8325
  45:     0x7f075155df70 - rust_try_inner
  46:     0x7f075155df60 - rust_try
  47:     0x7f0751503540 - unwind::try::hc4ccde5733fe2f0cf6d
  48:     0x7f07515032e0 - task::Task::run::h4d1bcb29f70db0c3xcd
  49:     0x7f0752cab8f0 - task::spawn_opts::closure.8271
  50:     0x7f0751505120 - thread::thread_start::h8729f7243e18bd84jBd
  51:     0x7f07507bb060 - start_thread
  52:     0x7f07511d4489 - __clone
  53:                0x0 - <unknown>

changing foo to use the old syntax allows the program to compile:

fn foo<'a, I: Iterator<&'a int>>(mut it: I) {}

fn main() {
    foo([1i, 2].iter());
}
@sfackler sfackler added the I-ICE label Aug 17, 2014
@sfackler
Copy link
Member Author

cc @pcwalton

@japaric
Copy link
Member

japaric commented Aug 17, 2014

I think this is similar to #16549

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants