{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/14062","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/14062/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/14062/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/14062/events","html_url":"https://github.com/rust-lang/rust/issues/14062","id":33176117,"number":14062,"title":"Pretty printer assertion using RUST_LOG and deriving Encodable","user":{"login":"jdm","id":27658,"avatar_url":"https://avatars.githubusercontent.com/u/27658?v=3","gravatar_id":"","url":"https://api.github.com/users/jdm","html_url":"https://github.com/jdm","followers_url":"https://api.github.com/users/jdm/followers","following_url":"https://api.github.com/users/jdm/following{/other_user}","gists_url":"https://api.github.com/users/jdm/gists{/gist_id}","starred_url":"https://api.github.com/users/jdm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdm/subscriptions","organizations_url":"https://api.github.com/users/jdm/orgs","repos_url":"https://api.github.com/users/jdm/repos","events_url":"https://api.github.com/users/jdm/events{/privacy}","received_events_url":"https://api.github.com/users/jdm/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":3,"created_at":"2014-05-09T14:20:55Z","updated_at":"2015-01-16T22:13:27Z","closed_at":"2015-01-16T22:13:27Z","body":"`RUST_LOG=rustc::middle::trans rustc derive.rs`\r\n```\r\nerror: internal compiler error: unexpected failure\r\nnote: the compiler hit an unexpected failure path. this is a bug.\r\nnote: we would appreciate a bug report: http://static.rust-lang.org/doc/master/complement-bugreport.html\r\nnote: run with `RUST_BACKTRACE=1` for a backtrace\r\ntask 'rustc' failed at 'assertion failed: body.expr.is_some()', /home/jdm/sdb/servo/src/compiler/rust/src/libsyntax/print/pprust.rs:1315\r\n```\r\nderive.rs is:\r\n```rust\r\nextern crate serialize;\r\n\r\nuse serialize::{Encodable, Encoder};\r\n\r\n#[deriving(Encodable)]\r\nstruct Attr;\r\n\r\nstruct JSTracer;\r\n\r\nimpl Encoder for JSTracer {\r\n    fn emit_nil(&mut self) {}\r\n    fn emit_uint(&mut self, _v: uint) {}\r\n    fn emit_u64(&mut self, _v: u64) {}\r\n    fn emit_u32(&mut self, __v: u32) {}\r\n    fn emit_u16(&mut self, _v: u16) {}\r\n    fn emit_u8(&mut self, _v: u8) {}\r\n    fn emit_int(&mut self, _v: int) {}\r\n    fn emit_i64(&mut self, _v: i64) {}\r\n    fn emit_i32(&mut self, _v: i32) {}\r\n    fn emit_i16(&mut self, _v: i16) {}\r\n    fn emit_i8(&mut self, _v: i8) {}\r\n    fn emit_bool(&mut self, _v: bool) {}\r\n    fn emit_f64(&mut self, _v: f64) {}\r\n    fn emit_f32(&mut self, _v: f32) {}\r\n    fn emit_char(&mut self, _v: char) {}\r\n    fn emit_str(&mut self, _v: &str) {}\r\n    fn emit_enum(&mut self, _name: &str, f: |&mut JSTracer|) {\r\n        f(self);\r\n    }\r\n    fn emit_enum_variant(&mut self, _v_name: &str, _v_id: uint, _len: uint, f: |&mut JSTracer|) {\r\n        f(self);\r\n    }\r\n    fn emit_enum_variant_arg(&mut self, _a_idx: uint, f: |&mut JSTracer|) {\r\n        f(self);\r\n    }\r\n    fn emit_enum_struct_variant(&mut self, _v_name: &str, _v_id: uint, _len: uint, f: |&mut JSTracer|) {\r\n        f(self);\r\n    }\r\n    fn emit_enum_struct_variant_field(&mut self, _f_name: &str, _f_idx: uint, f: |&mut JSTracer|) {\r\n        f(self);\r\n    }\r\n    fn emit_struct(&mut self, _name: &str, _len: uint, f: |&mut JSTracer|) {\r\n        f(self);\r\n    }\r\n    fn emit_struct_field(&mut self, _f_name: &str, _f_idx: uint, f: |&mut JSTracer|) {\r\n        f(self);\r\n    }\r\n    fn emit_tuple(&mut self, _len: uint, f: |&mut JSTracer|) {\r\n        f(self);\r\n    }\r\n    fn emit_tuple_arg(&mut self, _idx: uint, f: |&mut JSTracer|) {\r\n        f(self);\r\n    }\r\n    fn emit_tuple_struct(&mut self, _name: &str, _len: uint, f: |&mut JSTracer|) {\r\n        f(self);\r\n    }\r\n    fn emit_tuple_struct_arg(&mut self, _f_idx: uint, f: |&mut JSTracer|) {\r\n        f(self);\r\n    }\r\n    fn emit_option(&mut self, f: |&mut JSTracer|) {\r\n        f(self);\r\n    }\r\n    fn emit_option_none(&mut self) {}\r\n    fn emit_option_some(&mut self, f: |&mut JSTracer|) {\r\n        f(self);\r\n    }\r\n    fn emit_seq(&mut self, _len: uint, f: |this: &mut JSTracer|) {\r\n        f(self);\r\n    }\r\n    fn emit_seq_elt(&mut self, _idx: uint, f: |this: &mut JSTracer|) {\r\n        f(self);\r\n    }\r\n    fn emit_map(&mut self, _len: uint, f: |&mut JSTracer|) {\r\n        f(self);\r\n    }\r\n    fn emit_map_elt_key(&mut self, _idx: uint, f: |&mut JSTracer|) {\r\n        f(self);\r\n    }\r\n    fn emit_map_elt_val(&mut self, _idx: uint, f: |&mut JSTracer|) {\r\n        f(self);\r\n    }\r\n}\r\n\r\nfn main() {\r\n    let a = Attr;\r\n    let _  = a.encode(&mut JSTracer);\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/70331161","html_url":"https://github.com/rust-lang/rust/issues/14062#issuecomment-70331161","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/14062","id":70331161,"user":{"login":"jdm","id":27658,"avatar_url":"https://avatars.githubusercontent.com/u/27658?v=3","gravatar_id":"","url":"https://api.github.com/users/jdm","html_url":"https://github.com/jdm","followers_url":"https://api.github.com/users/jdm/followers","following_url":"https://api.github.com/users/jdm/following{/other_user}","gists_url":"https://api.github.com/users/jdm/gists{/gist_id}","starred_url":"https://api.github.com/users/jdm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdm/subscriptions","organizations_url":"https://api.github.com/users/jdm/orgs","repos_url":"https://api.github.com/users/jdm/repos","events_url":"https://api.github.com/users/jdm/events{/privacy}","received_events_url":"https://api.github.com/users/jdm/received_events","type":"User","site_admin":false},"created_at":"2015-01-16T22:13:27Z","updated_at":"2015-01-16T22:13:27Z","body":"I tried with\r\n```rust\r\nextern crate \"serialize\" as rustc_serialize;\r\n\r\nuse rustc_serialize::Encoder;\r\n\r\n#[derive(RustcEncodable)]\r\nstruct Attr;\r\n\r\nstruct JSTracer;\r\n\r\nimpl Encoder for JSTracer {\r\n    type Error = ();\r\n\r\n    fn emit_nil(&mut self) -> Result<(), ()> { Ok(()) }\r\n    fn emit_uint(&mut self, _v: uint) -> Result<(), ()> { Ok(()) }\r\n    fn emit_u64(&mut self, _v: u64) -> Result<(), ()> { Ok(()) }\r\n    fn emit_u32(&mut self, __v: u32) -> Result<(), ()> { Ok(()) }\r\n    fn emit_u16(&mut self, _v: u16) -> Result<(), ()> { Ok(()) }\r\n    fn emit_u8(&mut self, _v: u8) -> Result<(), ()> { Ok(()) }\r\n    fn emit_int(&mut self, _v: int) -> Result<(), ()> { Ok(()) }\r\n    fn emit_i64(&mut self, _v: i64) -> Result<(), ()> { Ok(()) }\r\n    fn emit_i32(&mut self, _v: i32) -> Result<(), ()> { Ok(()) }\r\n    fn emit_i16(&mut self, _v: i16) -> Result<(), ()> { Ok(()) }\r\n    fn emit_i8(&mut self, _v: i8) -> Result<(), ()> { Ok(()) }\r\n    fn emit_bool(&mut self, _v: bool) -> Result<(), ()> { Ok(()) }\r\n    fn emit_f64(&mut self, _v: f64) -> Result<(), ()> { Ok(()) }\r\n    fn emit_f32(&mut self, _v: f32) -> Result<(), ()> { Ok(()) }\r\n    fn emit_char(&mut self, _v: char) -> Result<(), ()> { Ok(()) }\r\n    fn emit_str(&mut self, _v: &str) -> Result<(), ()> { Ok(()) }\r\n    fn emit_enum<F>(&mut self, _name: &str, f: F) -> Result<(), ()> where F: FnOnce(&mut JSTracer) -> Result<(), ()> {\r\n        f(self)\r\n    }\r\n    fn emit_enum_variant<F>(&mut self, _v_name: &str, _v_id: uint, _len: uint, f: F) -> Result<(), ()> where F: FnOnce(&mut JSTracer) -> Result<(), ()> {\r\n        f(self)\r\n    }\r\n    fn emit_enum_variant_arg<F>(&mut self, _a_idx: uint, f: F) -> Result<(), ()> where F: FnOnce(&mut JSTracer) -> Result<(), ()> {\r\n        f(self)\r\n    }\r\n    fn emit_enum_struct_variant<F>(&mut self, _v_name: &str, _v_id: uint, _len: uint, f: F) -> Result<(), ()> where F: FnOnce(&mut JSTracer) -> Result<(), ()> {\r\n        f(self)\r\n    }\r\n    fn emit_enum_struct_variant_field<F>(&mut self, _f_name: &str, _f_idx: uint, f: F) -> Result<(), ()> where F: FnOnce(&mut JSTracer) -> Result<(), ()> {\r\n        f(self)\r\n    }\r\n    fn emit_struct<F>(&mut self, _name: &str, _len: uint, f: F) -> Result<(), ()> where F: FnOnce(&mut JSTracer) -> Result<(), ()> {\r\n        f(self)\r\n    }\r\n    fn emit_struct_field<F>(&mut self, _f_name: &str, _f_idx: uint, f: F) -> Result<(), ()> where F: FnOnce(&mut JSTracer) -> Result<(), ()> {\r\n        f(self)\r\n    }\r\n    fn emit_tuple<F>(&mut self, _len: uint, f: F) -> Result<(), ()> where F: FnOnce(&mut JSTracer) -> Result<(), ()> {\r\n        f(self)\r\n    }\r\n    fn emit_tuple_arg<F>(&mut self, _idx: uint, f: F) -> Result<(), ()> where F: FnOnce(&mut JSTracer) -> Result<(), ()> {\r\n        f(self)\r\n    }\r\n    fn emit_tuple_struct<F>(&mut self, _name: &str, _len: uint, f: F) -> Result<(), ()> where F: FnOnce(&mut JSTracer) -> Result<(), ()> {\r\n        f(self)\r\n    }\r\n    fn emit_tuple_struct_arg<F>(&mut self, _f_idx: uint, f: F) -> Result<(), ()> where F: FnOnce(&mut JSTracer) -> Result<(), ()> {\r\n        f(self)\r\n    }\r\n    fn emit_option<F>(&mut self, f: F) -> Result<(), ()> where F: FnOnce(&mut JSTracer) -> Result<(), ()> {\r\n        f(self)\r\n    }\r\n    fn emit_option_none(&mut self) -> Result<(), ()> { Ok(()) }\r\n    fn emit_option_some<F>(&mut self, f: F) -> Result<(), ()> where F: FnOnce(&mut JSTracer) -> Result<(), ()> {\r\n        f(self)\r\n    }\r\n    fn emit_seq<F>(&mut self, _len: uint, f: F) -> Result<(), ()> where F: FnOnce(&mut JSTracer) -> Result<(), ()> {\r\n        f(self)\r\n    }\r\n    fn emit_seq_elt<F>(&mut self, _idx: uint, f: F) -> Result<(), ()> where F: FnOnce(&mut JSTracer) -> Result<(), ()> {\r\n        f(self)\r\n    }\r\n    fn emit_map<F>(&mut self, _len: uint, f: F) -> Result<(), ()> where F: FnOnce(&mut JSTracer) -> Result<(), ()> {\r\n        f(self)\r\n    }\r\n    fn emit_map_elt_key<F>(&mut self, _idx: uint, f: F) -> Result<(), ()> where F: FnOnce(&mut JSTracer) -> Result<(), ()> {\r\n        f(self)\r\n    }\r\n    fn emit_map_elt_val<F>(&mut self, _idx: uint, f: F) -> Result<(), ()> where F: FnOnce(&mut JSTracer) -> Result<(), ()> {\r\n        f(self)\r\n    }\r\n}\r\n\r\nfn main() {\r\n    let a = Attr;\r\n    //let _  = a.encode(&mut JSTracer);\r\n}\r\n```\r\nbut couldn't reproduce."}}