{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/36053","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/36053/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/36053/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/36053/events","html_url":"https://github.com/rust-lang/rust/issues/36053","id":173613990,"number":36053,"title":"Type inference ICE: `assertion failed: !self.obligations_in_snapshot.get()`","user":{"login":"Stebalien","id":310393,"avatar_url":"https://avatars.githubusercontent.com/u/310393?v=3","gravatar_id":"","url":"https://api.github.com/users/Stebalien","html_url":"https://github.com/Stebalien","followers_url":"https://api.github.com/users/Stebalien/followers","following_url":"https://api.github.com/users/Stebalien/following{/other_user}","gists_url":"https://api.github.com/users/Stebalien/gists{/gist_id}","starred_url":"https://api.github.com/users/Stebalien/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stebalien/subscriptions","organizations_url":"https://api.github.com/users/Stebalien/orgs","repos_url":"https://api.github.com/users/Stebalien/repos","events_url":"https://api.github.com/users/Stebalien/events{/privacy}","received_events_url":"https://api.github.com/users/Stebalien/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":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-08-27T20:28:24Z","updated_at":"2016-08-28T00:41:27Z","closed_at":null,"body":"Type inference is barfing on:\r\n\r\n```rust\r\nuse std::iter::once;\r\nfn main() {\r\n    once::<&str>(\"str\").fuse().filter(|a: &str| true).count();\r\n}\r\n```\r\n\r\nThis only happens to iterators over ~~`&str`s~~ types with lifetime parameters and only happens when fused, mapped or filtered, than \"operated\" on (e.g., counted).\r\n\r\nThe following works:\r\n\r\n```\r\nuse std::iter::once;\r\nuse std::marker::PhantomData;\r\n\r\nstruct Test(&'static str);\r\n\r\nfn main() {\r\n    once(Test(\"asdf\")).fuse().filter(|_| true).count();\r\n}\r\n```\r\n\r\nTrace:\r\n\r\n```rust\r\nerror: internal compiler error: unexpected panic\r\n\r\nnote: the compiler unexpectedly panicked. this is a bug.\r\n\r\nnote: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports\r\n\r\nnote: run with `RUST_BACKTRACE=1` for a backtrace\r\n\r\nthread 'rustc' panicked at 'assertion failed: !self.obligations_in_snapshot.get()', ../src/librustc/infer/mod.rs:892\r\nstack backtrace:\r\n   1:      0x385616e5833 - std::sys::backtrace::tracing::imp::write::h482d45d91246faa2\r\n   2:      0x385616f611d - std::panicking::default_hook::_{{closure}}::h89158f66286b674e\r\n   3:      0x385616f466d - std::panicking::default_hook::h9e30d428ee3b0c43\r\n   4:      0x385616f4d68 - std::panicking::rust_panic_with_hook::h2224f33fb7bf2f4c\r\n   5:      0x3855e7daf2f - std::panicking::begin_panic::h6da27a7ee15843ce\r\n   6:      0x3855e9365e2 - rustc::infer::InferCtxt::rollback_to::ha2f21524af8937ee\r\n   7:      0x3855fea7ca3 - rustc_typeck::check::method::probe::ProbeContext::consider_candidates::_{{closure}}::hd73cab1de5c62a79\r\n   8:      0x3855fdebe5c - rustc_typeck::check::method::probe::ProbeContext::consider_candidates::hc4fd590b3d2a253e\r\n   9:      0x3855fdebb77 - rustc_typeck::check::method::probe::ProbeContext::pick_method::ha1525cf018083b3f\r\n  10:      0x3855fdeb0ca - rustc_typeck::check::method::probe::ProbeContext::pick_core::h8fe845d303e00275\r\n  11:      0x3855fea4ecc - rustc_typeck::check::method::probe::_<impl rustc_typeck..check..FnCtxt<'a, 'gcx, 'tcx>>::probe_method::_{{closure}}::h4cc364b0888ee90b\r\n  12:      0x3855fde7fda - rustc_typeck::check::method::probe::_<impl rustc_typeck..check..FnCtxt<'a, 'gcx, 'tcx>>::probe_method::h5bcb89eaeb8b15c2\r\n  13:      0x3855fdf278c - rustc_typeck::check::method::_<impl rustc_typeck..check..FnCtxt<'a, 'gcx, 'tcx>>::lookup_method::ha4b60fa1e48e18d1\r\n  14:      0x3855fe4c2df - rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref::h057aec20877fc49f\r\n  15:      0x3855fe4ed90 - rustc_typeck::check::FnCtxt::check_stmt::h0a693585a954d704\r\n  16:      0x3855fe4f177 - rustc_typeck::check::FnCtxt::check_block_with_expected::he043b17dca8afd62\r\n  17:      0x3855fe2245f - rustc_typeck::check::check_fn::hd55e09cd766201af\r\n  18:      0x3855fe20c1d - rustc_typeck::check::check_bare_fn::h56d8f43b26a6d362\r\n  19:      0x3855fe240a9 - rustc_typeck::check::check_item_body::h7d7e664619f18e7f\r\n  20:      0x3855fe1e088 - rustc_typeck::check::check_item_bodies::h7d884d53a15202d6\r\n  21:      0x3855fe89f53 - rustc_typeck::check_crate::h8ec8b2f490f5dc28\r\n  22:      0x38561ad739e - rustc_driver::driver::phase_3_run_analysis_passes::_{{closure}}::h45e03cee16dcf298\r\n  23:      0x38561a2ca9f - rustc::ty::context::TyCtxt::create_and_enter::h0021bc4caf3a2e06\r\n  24:      0x38561a9dfb4 - rustc_driver::driver::compile_input::hd9ecc57abd3cba85\r\n  25:      0x38561ac40ad - rustc_driver::run_compiler::h184264500271cc39\r\n  26:      0x38561a05b63 - std::panicking::try::do_call::h17a7a17ad7240c5c\r\n  27:      0x38561704336 - __rust_maybe_catch_panic\r\n  28:      0x38561a22f59 - _<F as alloc..boxed..FnBox<A>>::call_box::h95ef76c8d48c6f60\r\n  29:      0x385616f2ba0 - std::sys::thread::Thread::new::thread_start::he0bf102845911132\r\n  30:      0x38559b60453 - start_thread\r\n  31:      0x385613437de - __GI___clone\r\n  32:                0x0 - <unknown>\r\n```"},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/242948950","html_url":"https://github.com/rust-lang/rust/issues/36053#issuecomment-242948950","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/36053","id":242948950,"user":{"login":"Stebalien","id":310393,"avatar_url":"https://avatars.githubusercontent.com/u/310393?v=3","gravatar_id":"","url":"https://api.github.com/users/Stebalien","html_url":"https://github.com/Stebalien","followers_url":"https://api.github.com/users/Stebalien/followers","following_url":"https://api.github.com/users/Stebalien/following{/other_user}","gists_url":"https://api.github.com/users/Stebalien/gists{/gist_id}","starred_url":"https://api.github.com/users/Stebalien/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stebalien/subscriptions","organizations_url":"https://api.github.com/users/Stebalien/orgs","repos_url":"https://api.github.com/users/Stebalien/repos","events_url":"https://api.github.com/users/Stebalien/events{/privacy}","received_events_url":"https://api.github.com/users/Stebalien/received_events","type":"User","site_admin":false},"created_at":"2016-08-28T00:41:27Z","updated_at":"2016-08-28T00:41:27Z","body":"Note: This was is probably related to specialization. It's definitely not at all related to https://github.com/rust-lang/rust/pull/35656, I don't even know why you would suggest that. Any suggestion that uncommenting the commented line below is at all related to this problem will be met with derision:\r\n\r\n```rust\r\n#![feature(fused)]\r\nuse std::iter::FusedIterator;\r\n\r\nstruct Thing<'a>(&'a str);\r\nimpl<'a> Iterator for Thing<'a> {\r\n    type Item = &'a str;\r\n    fn next(&mut self) -> Option<&'a str> {\r\n        None\r\n    }\r\n}\r\n\r\n//impl<'a> FusedIterator for Thing<'a> {}\r\n\r\nfn main() {\r\n    Thing(\"test\").fuse().filter(|_| true).count();\r\n}\r\n```\r\n\r\n/cc @alexcrichton @aturon "}}
{"actor":{"display_login":"Stebalien"}}