{"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":23,"created_at":"2015-04-23T00:39:21Z","updated_at":"2015-04-23T23:23:46Z","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/95746155","html_url":"https://github.com/rust-lang/rfcs/pull/1085#issuecomment-95746155","issue_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1085","id":95746155,"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-23T23:23:46Z","updated_at":"2015-04-23T23:23:46Z","body":"By making such a RAII guard !Leak, you'd be disallowing perfectly desirable behaviour. Putting a RAII guard inside a not-cycle-proofed Rc is a completely legitimate thing to do: just because you may not want to do that in your particular use-case doesn't mean rust should forbid it, or that a library author writing such a RAII guard should try to impose that restriction on their users.\r\n\r\nRust should only try to prevent things that are objectively wrong (eg. segfaults and other memory unsafety), not subjectively wrong like what you're describing."}}