{"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":{"login":"nikomatsakis","id":155238,"avatar_url":"https://avatars.githubusercontent.com/u/155238?v=3","gravatar_id":"","url":"https://api.github.com/users/nikomatsakis","html_url":"https://github.com/nikomatsakis","followers_url":"https://api.github.com/users/nikomatsakis/followers","following_url":"https://api.github.com/users/nikomatsakis/following{/other_user}","gists_url":"https://api.github.com/users/nikomatsakis/gists{/gist_id}","starred_url":"https://api.github.com/users/nikomatsakis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikomatsakis/subscriptions","organizations_url":"https://api.github.com/users/nikomatsakis/orgs","repos_url":"https://api.github.com/users/nikomatsakis/repos","events_url":"https://api.github.com/users/nikomatsakis/events{/privacy}","received_events_url":"https://api.github.com/users/nikomatsakis/received_events","type":"User","site_admin":false},"milestone":null,"comments":37,"created_at":"2015-04-23T00:39:21Z","updated_at":"2015-04-28T08:35:58Z","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.\r\n\r\nEDIT: An implementation of Leak, including std and compiler changes, can be found here: https://github.com/reem/rust/tree/leak"},"comment":{"url":"https://api.github.com/repos/rust-lang/rfcs/issues/comments/96976615","html_url":"https://github.com/rust-lang/rfcs/pull/1085#issuecomment-96976615","issue_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1085","id":96976615,"user":{"login":"glaebhoerl","id":1216629,"avatar_url":"https://avatars.githubusercontent.com/u/1216629?v=3","gravatar_id":"","url":"https://api.github.com/users/glaebhoerl","html_url":"https://github.com/glaebhoerl","followers_url":"https://api.github.com/users/glaebhoerl/followers","following_url":"https://api.github.com/users/glaebhoerl/following{/other_user}","gists_url":"https://api.github.com/users/glaebhoerl/gists{/gist_id}","starred_url":"https://api.github.com/users/glaebhoerl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glaebhoerl/subscriptions","organizations_url":"https://api.github.com/users/glaebhoerl/orgs","repos_url":"https://api.github.com/users/glaebhoerl/repos","events_url":"https://api.github.com/users/glaebhoerl/events{/privacy}","received_events_url":"https://api.github.com/users/glaebhoerl/received_events","type":"User","site_admin":false},"created_at":"2015-04-28T08:35:58Z","updated_at":"2015-04-28T08:35:58Z","body":"> Rust only cares about memory safety, not about whether your program has a bug in it.\r\n\r\nThat's a bit extreme. There are many ways in which Rust tries to help ensure correctness even where memory safety is not implicated (`mut` checking, overflow checking, `match` exhaustiveness checking, lints, ... the list is probably long). Rust makes an iron-clad *guarantee* of safety, but that doesn't mean it shouldn't also try very hard for correctness. People who write Rust code care a whole lot about whether their code is correct. Every guarantee that Rust provides makes that job easier. It just happens to be the case that in `unsafe` blocks, correctness and safety often coincide."}}