{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/22914","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/22914/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/22914/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/22914/events","html_url":"https://github.com/rust-lang/rust/issues/22914","id":59368993,"number":22914,"title":"PhantomData is incomprehensible","user":{"login":"pornel","id":72159,"avatar_url":"https://avatars.githubusercontent.com/u/72159?v=3","gravatar_id":"","url":"https://api.github.com/users/pornel","html_url":"https://github.com/pornel","followers_url":"https://api.github.com/users/pornel/followers","following_url":"https://api.github.com/users/pornel/following{/other_user}","gists_url":"https://api.github.com/users/pornel/gists{/gist_id}","starred_url":"https://api.github.com/users/pornel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pornel/subscriptions","organizations_url":"https://api.github.com/users/pornel/orgs","repos_url":"https://api.github.com/users/pornel/repos","events_url":"https://api.github.com/users/pornel/events{/privacy}","received_events_url":"https://api.github.com/users/pornel/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang/rust/labels/A-docs","name":"A-docs","color":"d7e102"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-03-01T00:33:26Z","updated_at":"2015-03-02T16:46:42Z","closed_at":null,"body":"I need to give a Rust slice to a C API that will return an opaque handle (that actually contains a pointer to the slice), and the slice must outlive the handle.\r\n\r\n`rustc` nicely suggested using `PhantomData` for this, but the description of phantom data (and its RFC) for me is so far removed from my mental model/terminology of the problem, that it [sounds like git man pages to me](http://git-man-page-generator.lokaltog.net/). \r\n\r\n* \"…tell the compiler about fake fields\" — *fake field* doesn't sound like a thing I want to create. I'm not sure if a fake field is an actual Rust concept. I'm hoping it's a different way of saying a \"pointer that Rust isn't keeping track of\".\r\n\r\n* \"inform the compiler that one or more instances of the type T could be dropped\" — but does it actually drop anything? I want to prevent value from being dropped, so this confuses me.\r\n\r\nThe RFC is even worse, since it uses type variance terminology which is so confusing, that the most comprehensible description of them on Wikipedia is a **3D cube**!\r\n\r\n![3d variance](http://upload.wikimedia.org/wikipedia/commons/thumb/3/3e/Java_wildcard_subtyping.svg/700px-Java_wildcard_subtyping.svg.png)\r\n"},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/76748344","html_url":"https://github.com/rust-lang/rust/issues/22914#issuecomment-76748344","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/22914","id":76748344,"user":{"login":"bluss","id":3209739,"avatar_url":"https://avatars.githubusercontent.com/u/3209739?v=3","gravatar_id":"","url":"https://api.github.com/users/bluss","html_url":"https://github.com/bluss","followers_url":"https://api.github.com/users/bluss/followers","following_url":"https://api.github.com/users/bluss/following{/other_user}","gists_url":"https://api.github.com/users/bluss/gists{/gist_id}","starred_url":"https://api.github.com/users/bluss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluss/subscriptions","organizations_url":"https://api.github.com/users/bluss/orgs","repos_url":"https://api.github.com/users/bluss/repos","events_url":"https://api.github.com/users/bluss/events{/privacy}","received_events_url":"https://api.github.com/users/bluss/received_events","type":"User","site_admin":false},"created_at":"2015-03-02T16:46:42Z","updated_at":"2015-03-02T16:46:42Z","body":"If it's just to make the compiler shut up, then it's a good indication that the old default was better (not needing PhantomData for most unused type parameters)."}}