{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/29821","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/29821/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/29821/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/29821/events","html_url":"https://github.com/rust-lang/rust/issues/29821","id":116867392,"number":29821,"title":"An associated type magically adds a destructor?","user":{"login":"alevy","id":4689,"avatar_url":"https://avatars.githubusercontent.com/u/4689?v=3","gravatar_id":"","url":"https://api.github.com/users/alevy","html_url":"https://github.com/alevy","followers_url":"https://api.github.com/users/alevy/followers","following_url":"https://api.github.com/users/alevy/following{/other_user}","gists_url":"https://api.github.com/users/alevy/gists{/gist_id}","starred_url":"https://api.github.com/users/alevy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alevy/subscriptions","organizations_url":"https://api.github.com/users/alevy/orgs","repos_url":"https://api.github.com/users/alevy/repos","events_url":"https://api.github.com/users/alevy/events{/privacy}","received_events_url":"https://api.github.com/users/alevy/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang/rust/labels/A-traits","name":"A-traits","color":"d7e102"},{"url":"https://api.github.com/repos/rust-lang/rust/labels/I-wrong","name":"I-wrong","color":"e10c02"},{"url":"https://api.github.com/repos/rust-lang/rust/labels/T-compiler","name":"T-compiler","color":"bfd4f2"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2015-11-13T22:35:48Z","updated_at":"2016-10-08T22:31:25Z","closed_at":null,"body":"These two code snippets should functionally be doing the same thing, but the type checker seems to think one has a destructor. The difference seems to be in the reliance on an associated type.\r\n\r\n`rustc` complains that `myfoo` cannot be declared a mutable static because it has a desctructor:\r\n\r\n```rust\r\npub trait Foo {\r\n    type FooAssoc;\r\n}\r\n\r\npub struct Bar<F: Foo> {\r\n    id: F::FooAssoc\r\n}\r\n\r\npub struct Baz;\r\n\r\nimpl Foo for Baz {\r\n    type FooAssoc = usize;\r\n}\r\n\r\nstatic mut myfoo : Bar<Baz> = Bar { id: 0 };\r\n```\r\n\r\nWhile this, unsurprisingly, works:\r\n\r\n```rust\r\npub struct Bar<A> {\r\n    id: A\r\n}\r\n\r\nstatic mut myfoo : Bar<usize> = Bar { id: 0 };\r\n```\r\n\r\nHere are links to non-compiling/compiling examples on play.rust-lang:\r\n\r\n  * non-working: http://is.gd/BVUqfJ\r\n  * working: http://is.gd/lWbhzw\r\n"},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/252452148","html_url":"https://github.com/rust-lang/rust/issues/29821#issuecomment-252452148","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/29821","id":252452148,"user":{"login":"bstrie","id":865233,"avatar_url":"https://avatars.githubusercontent.com/u/865233?v=3","gravatar_id":"","url":"https://api.github.com/users/bstrie","html_url":"https://github.com/bstrie","followers_url":"https://api.github.com/users/bstrie/followers","following_url":"https://api.github.com/users/bstrie/following{/other_user}","gists_url":"https://api.github.com/users/bstrie/gists{/gist_id}","starred_url":"https://api.github.com/users/bstrie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bstrie/subscriptions","organizations_url":"https://api.github.com/users/bstrie/orgs","repos_url":"https://api.github.com/users/bstrie/repos","events_url":"https://api.github.com/users/bstrie/events{/privacy}","received_events_url":"https://api.github.com/users/bstrie/received_events","type":"User","site_admin":false},"created_at":"2016-10-08T22:31:25Z","updated_at":"2016-10-08T22:31:25Z","body":"Triage: still relevant."}}
{"actor":{"display_login":"bstrie"}}