{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rfcs/issues/1085","labels_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1085/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1085/comments","events_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1085/events","html_url":"https://github.com/rust-lang/rfcs/pull/1085","id":70270711,"number":1085,"title":"Leak and Destructor Guarantees","user":{"login":"reem","id":4745181,"avatar_url":"https://avatars.githubusercontent.com/u/4745181?v=3","gravatar_id":"","url":"https://api.github.com/users/reem","html_url":"https://github.com/reem","followers_url":"https://api.github.com/users/reem/followers","following_url":"https://api.github.com/users/reem/following{/other_user}","gists_url":"https://api.github.com/users/reem/gists{/gist_id}","starred_url":"https://api.github.com/users/reem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reem/subscriptions","organizations_url":"https://api.github.com/users/reem/orgs","repos_url":"https://api.github.com/users/reem/repos","events_url":"https://api.github.com/users/reem/events{/privacy}","received_events_url":"https://api.github.com/users/reem/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-04-23T00:39:21Z","updated_at":"2015-04-23T01:49:56Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rust-lang/rfcs/pulls/1085","html_url":"https://github.com/rust-lang/rfcs/pull/1085","diff_url":"https://github.com/rust-lang/rfcs/pull/1085.diff","patch_url":"https://github.com/rust-lang/rfcs/pull/1085.patch"},"body":"Add a new default unsafe trait, `Leak`. If a type does not implement `Leak` it can be\r\nmemory unsafe to fail to run the destructor of this type and continue execution of the\r\nprogram past this types lifetime.\r\n\r\nAdditionally, cause all panics in destructors to immediately abort the process,\r\nsolving two other notable bugs that allow leaking arbitrary data.\r\n\r\nAdd a safe variant of `mem::forget` (e.g. `mem::leak`) which requires `Leak`.\r\nThe existing `mem::forget` remains unbounded, but `unsafe`.\r\n\r\nThis proposal also requires a slight breaking change to a few `std` APIs to add\r\n`Leak` bounds where none exist currently. This is unfortunate so close to 1.0,\r\nbut in the author's opinion is better than dedicating to a safe unbounded `mem::forget`\r\nforever.\r\n\r\nThis RFC is largely an alternative to RFC PR 1066, which makes an unbounded `mem::forget`\r\nsafe."},"comment":{"url":"https://api.github.com/repos/rust-lang/rfcs/issues/comments/95387048","html_url":"https://github.com/rust-lang/rfcs/pull/1085#issuecomment-95387048","issue_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1085","id":95387048,"user":{"login":"Diggsey","id":451321,"avatar_url":"https://avatars.githubusercontent.com/u/451321?v=3","gravatar_id":"","url":"https://api.github.com/users/Diggsey","html_url":"https://github.com/Diggsey","followers_url":"https://api.github.com/users/Diggsey/followers","following_url":"https://api.github.com/users/Diggsey/following{/other_user}","gists_url":"https://api.github.com/users/Diggsey/gists{/gist_id}","starred_url":"https://api.github.com/users/Diggsey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Diggsey/subscriptions","organizations_url":"https://api.github.com/users/Diggsey/orgs","repos_url":"https://api.github.com/users/Diggsey/repos","events_url":"https://api.github.com/users/Diggsey/events{/privacy}","received_events_url":"https://api.github.com/users/Diggsey/received_events","type":"User","site_admin":false},"created_at":"2015-04-23T01:49:56Z","updated_at":"2015-04-23T01:49:56Z","body":"Yeah, it could also be solved by at some point later adding the concept of \"finalizers\", which are called by rust when an instance of that type goes out of scope via normal execution, and thus are allowed to panic, but are not given any of the same guarantees as destructors. That would also be completely backwards compatible."}}