{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rfcs/issues/1089","labels_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1089/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1089/comments","events_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1089/events","html_url":"https://github.com/rust-lang/rfcs/issues/1089","id":71087625,"number":1089,"title":"Add a way to exit a thread early and run destructors, akin to panic!(), without displaying an error message to the user","user":{"login":"filsmick","id":5556521,"avatar_url":"https://avatars.githubusercontent.com/u/5556521?v=3","gravatar_id":"","url":"https://api.github.com/users/filsmick","html_url":"https://github.com/filsmick","followers_url":"https://api.github.com/users/filsmick/followers","following_url":"https://api.github.com/users/filsmick/following{/other_user}","gists_url":"https://api.github.com/users/filsmick/gists{/gist_id}","starred_url":"https://api.github.com/users/filsmick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/filsmick/subscriptions","organizations_url":"https://api.github.com/users/filsmick/orgs","repos_url":"https://api.github.com/users/filsmick/repos","events_url":"https://api.github.com/users/filsmick/events{/privacy}","received_events_url":"https://api.github.com/users/filsmick/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-04-26T16:14:16Z","updated_at":"2015-04-26T17:44:02Z","closed_at":null,"body":"Unwinding the stack and running destructors is useful to abort a particular thread, without having to add early returns all the way up the call stack. `panic!()` provides this functionality, but also displays a message to the user, even if the panic is caught, which is disturbing: you don't want to expose debugging info such as line number to the end user.\r\n\r\nThis would provide a clean exit mechanism while avoiding adding functionality that's already there, as you get (correct me if I'm wrong) similar results with either early returns and `panic!()`: the stack unwinds, destructors are run, and the thread exits cleanly. This is not a problem for single-threaded programs, which can use `std::process::exit` and let the OS clean up resources, but would be useful for multi-threaded programs.\r\n\r\n**Essentially, I'm proposing a silent version of panic!()**, that does not actually panic (does not change the return value of http://doc.rust-lang.org/1.0.0-beta.2/std/thread/fn.panicking.html , for example), but acts as if all currently called functions returned early. Being able to `panic!()` without cluttering logs would probably also be useful."},"comment":{"url":"https://api.github.com/repos/rust-lang/rfcs/issues/comments/96412944","html_url":"https://github.com/rust-lang/rfcs/issues/1089#issuecomment-96412944","issue_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1089","id":96412944,"user":{"login":"filsmick","id":5556521,"avatar_url":"https://avatars.githubusercontent.com/u/5556521?v=3","gravatar_id":"","url":"https://api.github.com/users/filsmick","html_url":"https://github.com/filsmick","followers_url":"https://api.github.com/users/filsmick/followers","following_url":"https://api.github.com/users/filsmick/following{/other_user}","gists_url":"https://api.github.com/users/filsmick/gists{/gist_id}","starred_url":"https://api.github.com/users/filsmick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/filsmick/subscriptions","organizations_url":"https://api.github.com/users/filsmick/orgs","repos_url":"https://api.github.com/users/filsmick/repos","events_url":"https://api.github.com/users/filsmick/events{/privacy}","received_events_url":"https://api.github.com/users/filsmick/received_events","type":"User","site_admin":false},"created_at":"2015-04-26T17:44:02Z","updated_at":"2015-04-26T17:44:02Z","body":"@Diggsey how would you achieve that? http://is.gd/aDT4F7\r\n\r\n@nagisa I agree, panic!() should be a simple wrapper adding logging around a silent panic function."}}