{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/22812","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/22812/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/22812/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/22812/events","html_url":"https://github.com/rust-lang/rust/issues/22812","id":58964723,"number":22812,"title":"impl DerefMut<Target=Foo> on enum Baz { Baz(Bar) } where Bar: Foo explodes in trans with panic at Box<Any>","user":{"login":"eternaleye","id":99404,"avatar_url":"https://avatars.githubusercontent.com/u/99404?v=3","gravatar_id":"","url":"https://api.github.com/users/eternaleye","html_url":"https://github.com/eternaleye","followers_url":"https://api.github.com/users/eternaleye/followers","following_url":"https://api.github.com/users/eternaleye/following{/other_user}","gists_url":"https://api.github.com/users/eternaleye/gists{/gist_id}","starred_url":"https://api.github.com/users/eternaleye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eternaleye/subscriptions","organizations_url":"https://api.github.com/users/eternaleye/orgs","repos_url":"https://api.github.com/users/eternaleye/repos","events_url":"https://api.github.com/users/eternaleye/events{/privacy}","received_events_url":"https://api.github.com/users/eternaleye/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":2,"created_at":"2015-02-25T20:33:41Z","updated_at":"2015-04-22T16:54:56Z","closed_at":"2015-04-22T02:39:03Z","body":"```\r\nthread 'rustc' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/beta-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:189\r\n\r\nstack backtrace:\r\n   1:     0x7fc9c5f20200 - sys::backtrace::write::h520dd0378544e68eKlC\r\n   2:     0x7fc9c5f48ab0 - panicking::on_panic::h73bcbe74cf719159tXL\r\n   3:     0x7fc9c5e89710 - rt::unwind::begin_unwind_inner::h226bd1dfa9ab39a5RBL\r\n   4:     0x7fc9c3178a90 - rt::unwind::begin_unwind::h2352366649465682259\r\n   5:     0x7fc9c3179250 - diagnostic::Handler::bug::h24f8753792255451w4E\r\n   6:     0x7fc9c3ec6280 - session::Session::bug::h3ecc6cd354736e44Qnt\r\n   7:     0x7fc9c4b8f640 - trans::type_of::type_of::h40e0f02814030012zbp\r\n   8:     0x7fc9c4b8f640 - trans::type_of::type_of::h40e0f02814030012zbp\r\n   9:     0x7fc9c4c0bd30 - trans::type_of::arg_type_of::h5befcc9fe4a23b4bvap\r\n  10:     0x7fc9c4c3c6d0 - trans::type_of::type_of_rust_fn::hf6f0363db60b7391HYo\r\n  11:     0x7fc9c4c445e0 - trans::base::decl_rust_fn::h46f132ec784dec7cpjs\r\n  12:     0x7fc9c4c56f30 - trans::base::register_fn::h64f0f68951c950175Zu\r\n  13:     0x7fc9c4c59010 - trans::base::register_method::h75db41a2080c63fadEv\r\n  14:     0x7fc9c4b6e0b0 - trans::base::get_item_val::hfda2e9ac512d30d9Xmv\r\n  15:     0x7fc9c4b6bd60 - trans::base::trans_item::h2fccaa6d9562ddbezRu\r\n  16:     0x7fc9c4c592f0 - trans::base::trans_crate::h4a9b69700f9a02f61Ov\r\n  17:     0x7fc9c65a7190 - driver::phase_4_translate_to_llvm::hebaa5de771c2a8ebqPa\r\n  18:     0x7fc9c6580f70 - driver::compile_input::h094c71f01c3d97e4Gba\r\n  19:     0x7fc9c664ff30 - run_compiler::h2593dc6af08412c4Zbc\r\n  20:     0x7fc9c664e830 - thunk::F.Invoke<A, R>::invoke::h14283145127392528800\r\n  21:     0x7fc9c664d720 - rt::unwind::try::try_fn::h6903430089158945242\r\n  22:     0x7fc9c5fb5870 - rust_try_inner\r\n  23:     0x7fc9c5fb5860 - rust_try\r\n  24:     0x7fc9c664da20 - thunk::F.Invoke<A, R>::invoke::h8747893166239563621\r\n  25:     0x7fc9c5f34b50 - sys::thread::thread_start::hbf9a4c388c6ac6f093G\r\n  26:     0x7fc9bfe39190 - <unknown>\r\n  27:     0x7fc9c5b11e79 - __clone\r\n  28:                0x0 - <unknown>\r\n\r\n```\r\n\r\nThe code:\r\n\r\n```rust\r\ntrait Foo {\r\n    fn foo( &self );\r\n}\r\n\r\nstruct Bar;\r\nimpl Foo for Bar {\r\n    fn foo( &self ) { ; }\r\n}\r\n\r\nenum Baz {\r\n    Baz(Bar)\r\n}\r\n\r\nimpl std::ops::Deref for Baz {\r\n    type Target = Foo;\r\n    fn deref(&self) -> &<Baz as std::ops::Deref>::Target {\r\n        match self {\r\n            &Baz::Baz( ref t ) => t\r\n        }\r\n    }\r\n}\r\n\r\nimpl std::ops::DerefMut for Baz {\r\n    fn deref_mut(&mut self) -> &mut <Baz as std::ops::DerefMut>::Target {\r\n        match self {\r\n            &mut Baz::Baz( ref mut t ) => t\r\n        }\r\n    }\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/95263008","html_url":"https://github.com/rust-lang/rust/issues/22812#issuecomment-95263008","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/22812","id":95263008,"user":{"login":"tamird","id":1535036,"avatar_url":"https://avatars.githubusercontent.com/u/1535036?v=3","gravatar_id":"","url":"https://api.github.com/users/tamird","html_url":"https://github.com/tamird","followers_url":"https://api.github.com/users/tamird/followers","following_url":"https://api.github.com/users/tamird/following{/other_user}","gists_url":"https://api.github.com/users/tamird/gists{/gist_id}","starred_url":"https://api.github.com/users/tamird/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tamird/subscriptions","organizations_url":"https://api.github.com/users/tamird/orgs","repos_url":"https://api.github.com/users/tamird/repos","events_url":"https://api.github.com/users/tamird/events{/privacy}","received_events_url":"https://api.github.com/users/tamird/received_events","type":"User","site_admin":false},"created_at":"2015-04-22T16:54:56Z","updated_at":"2015-04-22T16:54:56Z","body":"With minor updates this compiles without error:\r\n```rust\r\ntrait Foo {\r\n    fn foo( &self );\r\n}\r\n\r\nstruct Bar;\r\nimpl Foo for Bar {\r\n    fn foo( &self ) { ; }\r\n}\r\n\r\nenum Baz {\r\n    Baz(Bar)\r\n}\r\n\r\nimpl std::ops::Deref for Baz {\r\n    type Target = Foo;\r\n    fn deref(&self) -> &Self::Target {\r\n        match self {\r\n            &Baz::Baz( ref t ) => t\r\n        }\r\n    }\r\n}\r\n\r\nimpl std::ops::DerefMut for Baz {\r\n    fn deref_mut(&mut self) -> &mut Self::Target {\r\n        match self {\r\n            &mut Baz::Baz( ref mut t ) => t\r\n        }\r\n    }\r\n}\r\nfn main() {\r\n  // Add code here\r\n}\r\n\r\n```"}}