{"action":"opened","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/20614","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/20614/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/20614/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/20614/events","html_url":"https://github.com/rust-lang/rust/issues/20614","id":53484585,"number":20614,"title":"ICE when using slicing syntax with invalid code","user":{"login":"quantheory","id":1740206,"avatar_url":"https://avatars.githubusercontent.com/u/1740206?v=3","gravatar_id":"","url":"https://api.github.com/users/quantheory","html_url":"https://github.com/quantheory","followers_url":"https://api.github.com/users/quantheory/followers","following_url":"https://api.github.com/users/quantheory/following{/other_user}","gists_url":"https://api.github.com/users/quantheory/gists{/gist_id}","starred_url":"https://api.github.com/users/quantheory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quantheory/subscriptions","organizations_url":"https://api.github.com/users/quantheory/orgs","repos_url":"https://api.github.com/users/quantheory/repos","events_url":"https://api.github.com/users/quantheory/events{/privacy}","received_events_url":"https://api.github.com/users/quantheory/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-01-06T06:09:36Z","updated_at":"2015-01-06T06:09:36Z","closed_at":null,"body":"While trying to grok/update some old code, I found that an ICE occurs in the following (invalid) code:\r\n\r\n```rust\r\n#![feature(slicing_syntax)]\r\n#![feature(unboxed_closures)]\r\n\r\n#![crate_type = \"lib\"]\r\n\r\nuse std::cell::RefCell;\r\nuse std::sync::Mutex;\r\n\r\npub struct InductionSeq<T> {\r\n    recursor: fn(&[T]) -> T,\r\n    cache: Mutex<RefCell<Vec<T>>>,\r\n}\r\n\r\nimpl<T> InductionSeq<T> {\r\n    fn grow_cache_one(&self) {\r\n        let mut cache = self.cache.lock().unwrap().borrow_mut();\r\n        let recursor: Box<Fn(&[T]) -> T> = box self.recursor;\r\n        let new_item = recursor.call((cache[],));\r\n    }\r\n}\r\n```\r\n\r\nThe error/output:\r\n\r\n```\r\ninf_seq.rs:18:36: 18:42 error: type `std::sync::mutex::Mutex<core::cell::RefCell<collections::vec::Vec<T>>>` does not implement any method in scope named `lock`\r\ninf_seq.rs:18         let mut cache = self.cache.lock().unwrap().borrow_mut();\r\n                                                 ^~~~~~\r\nerror: internal compiler error: no type for node 68: expr  (id=68) in fcx 0x30a517e51f8\r\nnote: the compiler unexpectedly panicked. this is a bug.\r\nnote: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html\r\nnote: run with `RUST_BACKTRACE=1` for a backtrace\r\nthread 'rustc' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:182\r\n\r\nstack backtrace:\r\n   1:      0x30a593d22d0 - sys::backtrace::write::h8532e701ef86014f4it\r\n   2:      0x30a593f7b00 - failure::on_fail::h7532e1f79d134d5dzvz\r\n   3:      0x30a5935d1c0 - rt::unwind::begin_unwind_inner::h97b151606151d62deaz\r\n   4:      0x30a5422fc60 - rt::unwind::begin_unwind::h15809447133099964284\r\n   5:      0x30a54230510 - diagnostic::Handler::bug::h8818b567cf47e6a0DLF\r\n   6:      0x30a5756acf0 - session::Session::bug::h251da16737c526c0lrq\r\n   7:      0x30a58990ec0 - check::FnCtxt<'a, 'tcx>::node_ty::h8b4513e3177b34b9FAl\r\n   8:      0x30a589a6390 - check::writeback::WritebackCx<'cx, 'tcx>::visit_node_id::hadb4e437b164af77oDb\r\n   9:      0x30a589a2620 - check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_expr::h773756089457ec03otb\r\n  10:      0x30a589a2620 - check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_expr::h773756089457ec03otb\r\n  11:      0x30a589a2620 - check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_expr::h773756089457ec03otb\r\n  12:      0x30a589a6290 - check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_block::h73bb9a8ed95e2890Dub\r\n  13:      0x30a58a76b40 - check::check_bare_fn::h592fda8aa741d710Qtj\r\n  14:      0x30a58a7cf70 - check::check_method_body::ha0d2d56085b511095Vj\r\n  15:      0x30a58a6e170 - check::check_item::h9827005a9cde6421CMj\r\n  16:      0x30a58c0efe0 - check_crate::unboxed_closure.40162\r\n  17:      0x30a58c09c30 - check_crate::h19fb6dea5733566ajsx\r\n  18:      0x30a59923640 - driver::phase_3_run_analysis_passes::h46b1604d9f9f5633Tva\r\n  19:      0x30a59911ae0 - driver::compile_input::h68b8602933aad8d7wba\r\n  20:      0x30a599dceb0 - thunk::F.Invoke<A, R>::invoke::h18029802347644288836\r\n  21:      0x30a599dbc60 - rt::unwind::try::try_fn::h6518866316425934196\r\n  22:      0x30a5945e400 - rust_try_inner\r\n  23:      0x30a5945e3f0 - rust_try\r\n  24:      0x30a599dbfb0 - thunk::F.Invoke<A, R>::invoke::h15513809553472565307\r\n  25:      0x30a593e3e40 - sys::thread::thread_start::h5ea7ba97235331d5a9v\r\n  26:      0x30a53a541a0 - <unknown>\r\n  27:      0x30a590142b9 - clone\r\n  28:                0x0 - <unknown>\r\n```\r\n"}}