{"action":"closed","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/26802","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/26802/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/26802/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/26802/events","html_url":"https://github.com/rust-lang/rust/issues/26802","id":93125555,"number":26802,"title":"ICE: \"Type parameter out of range when substituting in region 'b \"","user":{"login":"qrlpx","id":5961258,"avatar_url":"https://avatars.githubusercontent.com/u/5961258?v=3","gravatar_id":"","url":"https://api.github.com/users/qrlpx","html_url":"https://github.com/qrlpx","followers_url":"https://api.github.com/users/qrlpx/followers","following_url":"https://api.github.com/users/qrlpx/following{/other_user}","gists_url":"https://api.github.com/users/qrlpx/gists{/gist_id}","starred_url":"https://api.github.com/users/qrlpx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qrlpx/subscriptions","organizations_url":"https://api.github.com/users/qrlpx/orgs","repos_url":"https://api.github.com/users/qrlpx/repos","events_url":"https://api.github.com/users/qrlpx/events{/privacy}","received_events_url":"https://api.github.com/users/qrlpx/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang/rust/labels/I-ICE","name":"I-ICE","color":"e10c02"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-05T16:47:24Z","updated_at":"2015-07-20T21:21:33Z","closed_at":"2015-07-20T21:21:33Z","body":"Stumbled upon the following error when trying to box a trait where a inner lifetime (function) needs to be a subtype of an outer lifetime (trait)\r\n\r\n### playpen \r\nhttp://is.gd/tFVEpb\r\n\r\n### code\r\n```rust\r\ntrait Foo<'a> {\r\n    fn bar<'b>(&self, _: &'b u8)\r\n        where 'a: 'b\r\n    {\r\n        /* */\r\n    }\r\n}\r\n\r\npub struct FooBar;\r\n\r\nimpl Foo<'static> for FooBar {}\r\n\r\nfn test(foobar: FooBar) -> Box<Foo<'static>> {\r\n    Box::new(foobar)\r\n}\r\n```\r\n\r\n### rustc output\r\n```\r\ntest.rs:1:1: 1:1 error: internal compiler error: Type parameter out of range when substituting in region 'b (root type=None) (space=FnSpace, index=0)\r\ntest.rs:1 trait Foo<'a> {\r\n          ^\r\nnote: the compiler unexpectedly panicked. this is a bug.\r\nnote: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports\r\nthread 'rustc' panicked at 'Box<Any>', ../src/libsyntax/diagnostic.rs:176\r\n\r\nstack backtrace:\r\n   1:     0x7ffb665895ee - sys::backtrace::write::h04a6ced565b26815Lqs\r\n   2:     0x7ffb66591214 - panicking::on_panic::h521f84b604e22dfel8w\r\n   3:     0x7ffb6655404e - rt::unwind::begin_unwind_inner::hd3dee614a0e1c16cZNw\r\n   4:     0x7ffb638fcfdc - rt::unwind::begin_unwind::h16902420993434601027\r\n   5:     0x7ffb638fcf7b - diagnostic::SpanHandler::span_bug::he796b64f9a06f78eO4A\r\n   6:     0x7ffb64669e5b - middle::subst::SubstFolder<'a, 'tcx>.TypeFolder<'tcx>::fold_region::h824e080844b5206eqxP\r\n   7:     0x7ffb6544fd0a - iter::Map<I, F>.Iterator::next::h5056066582399914445\r\n   8:     0x7ffb6544d88e - trans::meth::emit_vtable_methods::closure.51812\r\n   9:     0x7ffb6544d377 - vec::Vec<T>.FromIterator<T>::from_iter::h17428483855504841875\r\n  10:     0x7ffb6544b5ca - trans::meth::get_vtable::closure.51758\r\n  11:     0x7ffb6544cdf4 - iter::FlatMap<I, U, F>.Iterator::next::h4997041961090004455\r\n  12:     0x7ffb6544cfbc - vec::Vec<T>::extend_desugared::h12545681854704529801\r\n  13:     0x7ffb6544c0a0 - iter::Iterator::collect::h17523528891276393804\r\n  14:     0x7ffb653b41f4 - trans::expr::unsized_info::h961a6a3ae2325378yIA\r\n  15:     0x7ffb653f1891 - trans::expr::coerce_unsized::h31652873fa02683flTA\r\n  16:     0x7ffb6533612c - trans::expr::trans::h541cacb4f6a005b5MAA\r\n  17:     0x7ffb653c4c22 - trans::expr::trans_into::h08f0184a4039fa63wuA\r\n  18:     0x7ffb65353035 - trans::controlflow::trans_block::h05d78924f32999a4Smv\r\n  19:     0x7ffb65351a36 - trans::base::trans_closure::hcbb7e42b32822a38R1h\r\n  20:     0x7ffb653535a7 - trans::base::trans_fn::hacbcaecdbf410a30pci\r\n  21:     0x7ffb6535646f - trans::base::trans_item::he017b8b1980c8d10vAi\r\n  22:     0x7ffb65363618 - trans::base::trans_crate::h37b278a44ad52ceasoj\r\n  23:     0x7ffb66af24be - driver::phase_4_translate_to_llvm::hb64c06949a503dda2Oa\r\n  24:     0x7ffb66aed066 - driver::phase_3_run_analysis_passes::closure.15783\r\n  25:     0x7ffb66ae8633 - middle::ty::ctxt<'tcx>::create_and_enter::h349256048753845929\r\n  26:     0x7ffb66ae3a17 - driver::phase_3_run_analysis_passes::h15521018079403107052\r\n  27:     0x7ffb66ac6266 - driver::compile_input::hbf698b02349f7ce3Tba\r\n  28:     0x7ffb66b9fed3 - run_compiler::hd724b5fef3441688y7b\r\n  29:     0x7ffb66b9d8ae - boxed::F.FnBox<A>::call_box::h6609070342514802751\r\n  30:     0x7ffb66b9d0f9 - rt::unwind::try::try_fn::h10774555836369096370\r\n  31:     0x7ffb6660ad48 - rust_try_inner\r\n  32:     0x7ffb6660ad35 - rust_try\r\n  33:     0x7ffb6657c8a7 - rt::unwind::try::inner_try::hb0d7a3eb324339ceSJw\r\n  34:     0x7ffb66b9d30b - boxed::F.FnBox<A>::call_box::h18179817771297192954\r\n  35:     0x7ffb6658fe71 - sys::thread::Thread::new::thread_start::hf8c7448e27294ed0PTv\r\n  36:     0x7ffb601b90a4 - start_thread\r\n  37:     0x7ffb661dacfc - clone\r\n  38:                0x0 - <unknown>\r\n```\r\n\r\n### rustc version\r\n```\r\nrustc 1.3.0-nightly (bf3c979ec 2015-06-30)\r\nbinary: rustc\r\ncommit-hash: bf3c979ec31300e38c1607d605cf47f231bf6480\r\ncommit-date: 2015-06-30\r\nhost: x86_64-unknown-linux-gnu\r\nrelease: 1.3.0-nightly\r\n```\r\n"}}