{"action":"created","comment":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/comments/92092879","pull_request_review_id":12601804,"id":92092879,"diff_hunk":"@@ -25,45 +27,107 @@ pub const HEX_WIDTH: usize = 18;\n #[cfg(target_pointer_width = \"32\")]\n pub const HEX_WIDTH: usize = 10;\n \n+#[derive(Debug, Copy, Clone, Eq, PartialEq)]\n+pub enum PrintFormat {\n+    Full = 2,\n+    Short = 3,\n+}\n+\n // For now logging is turned off by default, and this function checks to see\n // whether the magical environment variable is present to see if it's turned on.\n-pub fn log_enabled() -> bool {\n+pub fn log_enabled() -> Option<PrintFormat> {\n     static ENABLED: atomic::AtomicIsize = atomic::AtomicIsize::new(0);\n     match ENABLED.load(Ordering::SeqCst) {\n-        1 => return false,\n-        2 => return true,\n-        _ => {}\n+        0 => {},\n+        1 => return None,\n+        2 => return Some(PrintFormat::Full),\n+        3 => return Some(PrintFormat::Short),\n+        _ => unreachable!(),\n     }\n \n     let val = match env::var_os(\"RUST_BACKTRACE\") {\n-        Some(x) => if &x == \"0\" { 1 } else { 2 },\n-        None => 1,\n+        Some(x) => if [\"no\", \"0\"].iter().any(|val| &x == *val) {","path":"src/libstd/sys_common/backtrace.rs","position":null,"original_position":38,"commit_id":"ddfef1515af456ae315531516d0c88f9721c0816","original_commit_id":"d175525ec410c7a472eef98ad69ac0284d9240d1","user":{"login":"Yamakaky","id":1327378,"avatar_url":"https://avatars.githubusercontent.com/u/1327378?v=3","gravatar_id":"","url":"https://api.github.com/users/Yamakaky","html_url":"https://github.com/Yamakaky","followers_url":"https://api.github.com/users/Yamakaky/followers","following_url":"https://api.github.com/users/Yamakaky/following{/other_user}","gists_url":"https://api.github.com/users/Yamakaky/gists{/gist_id}","starred_url":"https://api.github.com/users/Yamakaky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yamakaky/subscriptions","organizations_url":"https://api.github.com/users/Yamakaky/orgs","repos_url":"https://api.github.com/users/Yamakaky/repos","events_url":"https://api.github.com/users/Yamakaky/events{/privacy}","received_events_url":"https://api.github.com/users/Yamakaky/received_events","type":"User","site_admin":false},"body":"Fixed in ddfef15.","created_at":"2016-12-13T03:38:39Z","updated_at":"2016-12-13T03:38:39Z","html_url":"https://github.com/rust-lang/rust/pull/38165#discussion_r92092879","pull_request_url":"https://api.github.com/repos/rust-lang/rust/pulls/38165","_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/comments/92092879"},"html":{"href":"https://github.com/rust-lang/rust/pull/38165#discussion_r92092879"},"pull_request":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/38165"}}},"pull_request":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/38165","id":96448312,"html_url":"https://github.com/rust-lang/rust/pull/38165","diff_url":"https://github.com/rust-lang/rust/pull/38165.diff","patch_url":"https://github.com/rust-lang/rust/pull/38165.patch","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/38165","number":38165,"state":"open","locked":false,"title":"Improve backtrace formating while panicking.","user":{"login":"Yamakaky","id":1327378,"avatar_url":"https://avatars.githubusercontent.com/u/1327378?v=3","gravatar_id":"","url":"https://api.github.com/users/Yamakaky","html_url":"https://github.com/Yamakaky","followers_url":"https://api.github.com/users/Yamakaky/followers","following_url":"https://api.github.com/users/Yamakaky/following{/other_user}","gists_url":"https://api.github.com/users/Yamakaky/gists{/gist_id}","starred_url":"https://api.github.com/users/Yamakaky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yamakaky/subscriptions","organizations_url":"https://api.github.com/users/Yamakaky/orgs","repos_url":"https://api.github.com/users/Yamakaky/repos","events_url":"https://api.github.com/users/Yamakaky/events{/privacy}","received_events_url":"https://api.github.com/users/Yamakaky/received_events","type":"User","site_admin":false},"body":"Fixes #37783.\r\n\r\nDone:\r\n\r\n- Fix alignment of file paths for better readability\r\n- `RUST_BACKTRACE=full` prints all the informations (current behaviour)\r\n- `RUST_BACKTRACE=(short|yes)` is the default and does:\r\n  - Skip irrelevant frames at the beginning and the end\r\n  - Remove function address\r\n  - Remove the current directory from the absolute paths\r\n  - Remove the build root of the stdlib from the absolute paths\r\n  - Remove `::hfabe6541873` at the end of the symbols\r\n- `RUST_BACKTRACE=(0|no)` disables the backtrace.\r\n- `RUST_BACKTRACE=<everything else>` is equivalent to `short` for\r\n  backward compatibility.\r\n\r\nTODO:\r\n\r\n- doc\r\n- Remove path prefix for libraries (help needed)\r\n\r\nExample of short backtrace:\r\n```\r\nthread 'main' panicked at 'explicit panic', t.rs:2\r\nstack backtrace:\r\n{ skipping 5 frames }\r\n   6:    t::test\r\n             at ./t.rs:2\r\n   7:    t::main::{{closure}}\r\n             at ./t.rs:6\r\n   8:    <core::result::Result<T, E>>::map\r\n             at builtin file libcore/result.rs:465\r\n   9:    t::main\r\n             at ./t.rs:6\r\n{ skipping 6 frames }\r\n```\r\nI'll refactor the commits before merge.","created_at":"2016-12-04T21:51:37Z","updated_at":"2016-12-13T03:38:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a46399b01413a3f0aa48ed66a4470a00a3e5ff78","assignee":{"login":"alexcrichton","id":64996,"avatar_url":"https://avatars.githubusercontent.com/u/64996?v=3","gravatar_id":"","url":"https://api.github.com/users/alexcrichton","html_url":"https://github.com/alexcrichton","followers_url":"https://api.github.com/users/alexcrichton/followers","following_url":"https://api.github.com/users/alexcrichton/following{/other_user}","gists_url":"https://api.github.com/users/alexcrichton/gists{/gist_id}","starred_url":"https://api.github.com/users/alexcrichton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexcrichton/subscriptions","organizations_url":"https://api.github.com/users/alexcrichton/orgs","repos_url":"https://api.github.com/users/alexcrichton/repos","events_url":"https://api.github.com/users/alexcrichton/events{/privacy}","received_events_url":"https://api.github.com/users/alexcrichton/received_events","type":"User","site_admin":false},"assignees":[{"login":"alexcrichton","id":64996,"avatar_url":"https://avatars.githubusercontent.com/u/64996?v=3","gravatar_id":"","url":"https://api.github.com/users/alexcrichton","html_url":"https://github.com/alexcrichton","followers_url":"https://api.github.com/users/alexcrichton/followers","following_url":"https://api.github.com/users/alexcrichton/following{/other_user}","gists_url":"https://api.github.com/users/alexcrichton/gists{/gist_id}","starred_url":"https://api.github.com/users/alexcrichton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexcrichton/subscriptions","organizations_url":"https://api.github.com/users/alexcrichton/orgs","repos_url":"https://api.github.com/users/alexcrichton/repos","events_url":"https://api.github.com/users/alexcrichton/events{/privacy}","received_events_url":"https://api.github.com/users/alexcrichton/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/rust-lang/rust/pulls/38165/commits","review_comments_url":"https://api.github.com/repos/rust-lang/rust/pulls/38165/comments","review_comment_url":"https://api.github.com/repos/rust-lang/rust/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/38165/comments","statuses_url":"https://api.github.com/repos/rust-lang/rust/statuses/ddfef1515af456ae315531516d0c88f9721c0816","head":{"label":"Yamakaky:better-backtrace","ref":"better-backtrace","sha":"ddfef1515af456ae315531516d0c88f9721c0816","user":{"login":"Yamakaky","id":1327378,"avatar_url":"https://avatars.githubusercontent.com/u/1327378?v=3","gravatar_id":"","url":"https://api.github.com/users/Yamakaky","html_url":"https://github.com/Yamakaky","followers_url":"https://api.github.com/users/Yamakaky/followers","following_url":"https://api.github.com/users/Yamakaky/following{/other_user}","gists_url":"https://api.github.com/users/Yamakaky/gists{/gist_id}","starred_url":"https://api.github.com/users/Yamakaky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yamakaky/subscriptions","organizations_url":"https://api.github.com/users/Yamakaky/orgs","repos_url":"https://api.github.com/users/Yamakaky/repos","events_url":"https://api.github.com/users/Yamakaky/events{/privacy}","received_events_url":"https://api.github.com/users/Yamakaky/received_events","type":"User","site_admin":false},"repo":{"id":75566055,"name":"rust","full_name":"Yamakaky/rust","owner":{"login":"Yamakaky","id":1327378,"avatar_url":"https://avatars.githubusercontent.com/u/1327378?v=3","gravatar_id":"","url":"https://api.github.com/users/Yamakaky","html_url":"https://github.com/Yamakaky","followers_url":"https://api.github.com/users/Yamakaky/followers","following_url":"https://api.github.com/users/Yamakaky/following{/other_user}","gists_url":"https://api.github.com/users/Yamakaky/gists{/gist_id}","starred_url":"https://api.github.com/users/Yamakaky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yamakaky/subscriptions","organizations_url":"https://api.github.com/users/Yamakaky/orgs","repos_url":"https://api.github.com/users/Yamakaky/repos","events_url":"https://api.github.com/users/Yamakaky/events{/privacy}","received_events_url":"https://api.github.com/users/Yamakaky/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Yamakaky/rust","description":"A safe, concurrent, practical language.","fork":true,"url":"https://api.github.com/repos/Yamakaky/rust","forks_url":"https://api.github.com/repos/Yamakaky/rust/forks","keys_url":"https://api.github.com/repos/Yamakaky/rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Yamakaky/rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Yamakaky/rust/teams","hooks_url":"https://api.github.com/repos/Yamakaky/rust/hooks","issue_events_url":"https://api.github.com/repos/Yamakaky/rust/issues/events{/number}","events_url":"https://api.github.com/repos/Yamakaky/rust/events","assignees_url":"https://api.github.com/repos/Yamakaky/rust/assignees{/user}","branches_url":"https://api.github.com/repos/Yamakaky/rust/branches{/branch}","tags_url":"https://api.github.com/repos/Yamakaky/rust/tags","blobs_url":"https://api.github.com/repos/Yamakaky/rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Yamakaky/rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Yamakaky/rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/Yamakaky/rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Yamakaky/rust/statuses/{sha}","languages_url":"https://api.github.com/repos/Yamakaky/rust/languages","stargazers_url":"https://api.github.com/repos/Yamakaky/rust/stargazers","contributors_url":"https://api.github.com/repos/Yamakaky/rust/contributors","subscribers_url":"https://api.github.com/repos/Yamakaky/rust/subscribers","subscription_url":"https://api.github.com/repos/Yamakaky/rust/subscription","commits_url":"https://api.github.com/repos/Yamakaky/rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/Yamakaky/rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/Yamakaky/rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/Yamakaky/rust/issues/comments{/number}","contents_url":"https://api.github.com/repos/Yamakaky/rust/contents/{+path}","compare_url":"https://api.github.com/repos/Yamakaky/rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Yamakaky/rust/merges","archive_url":"https://api.github.com/repos/Yamakaky/rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Yamakaky/rust/downloads","issues_url":"https://api.github.com/repos/Yamakaky/rust/issues{/number}","pulls_url":"https://api.github.com/repos/Yamakaky/rust/pulls{/number}","milestones_url":"https://api.github.com/repos/Yamakaky/rust/milestones{/number}","notifications_url":"https://api.github.com/repos/Yamakaky/rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Yamakaky/rust/labels{/name}","releases_url":"https://api.github.com/repos/Yamakaky/rust/releases{/id}","deployments_url":"https://api.github.com/repos/Yamakaky/rust/deployments","created_at":"2016-12-04T21:35:22Z","updated_at":"2016-12-04T21:35:41Z","pushed_at":"2016-12-13T03:38:20Z","git_url":"git://github.com/Yamakaky/rust.git","ssh_url":"git@github.com:Yamakaky/rust.git","clone_url":"https://github.com/Yamakaky/rust.git","svn_url":"https://github.com/Yamakaky/rust","homepage":"https://www.rust-lang.org","size":314505,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rust-lang:master","ref":"master","sha":"b5d0f90929ddaae89609e9bb229a9b8a27e27615","user":{"login":"rust-lang","id":5430905,"avatar_url":"https://avatars.githubusercontent.com/u/5430905?v=3","gravatar_id":"","url":"https://api.github.com/users/rust-lang","html_url":"https://github.com/rust-lang","followers_url":"https://api.github.com/users/rust-lang/followers","following_url":"https://api.github.com/users/rust-lang/following{/other_user}","gists_url":"https://api.github.com/users/rust-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-lang/subscriptions","organizations_url":"https://api.github.com/users/rust-lang/orgs","repos_url":"https://api.github.com/users/rust-lang/repos","events_url":"https://api.github.com/users/rust-lang/events{/privacy}","received_events_url":"https://api.github.com/users/rust-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":724712,"name":"rust","full_name":"rust-lang/rust","owner":{"login":"rust-lang","id":5430905,"avatar_url":"https://avatars.githubusercontent.com/u/5430905?v=3","gravatar_id":"","url":"https://api.github.com/users/rust-lang","html_url":"https://github.com/rust-lang","followers_url":"https://api.github.com/users/rust-lang/followers","following_url":"https://api.github.com/users/rust-lang/following{/other_user}","gists_url":"https://api.github.com/users/rust-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-lang/subscriptions","organizations_url":"https://api.github.com/users/rust-lang/orgs","repos_url":"https://api.github.com/users/rust-lang/repos","events_url":"https://api.github.com/users/rust-lang/events{/privacy}","received_events_url":"https://api.github.com/users/rust-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rust-lang/rust","description":"A safe, concurrent, practical language.","fork":false,"url":"https://api.github.com/repos/rust-lang/rust","forks_url":"https://api.github.com/repos/rust-lang/rust/forks","keys_url":"https://api.github.com/repos/rust-lang/rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rust-lang/rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rust-lang/rust/teams","hooks_url":"https://api.github.com/repos/rust-lang/rust/hooks","issue_events_url":"https://api.github.com/repos/rust-lang/rust/issues/events{/number}","events_url":"https://api.github.com/repos/rust-lang/rust/events","assignees_url":"https://api.github.com/repos/rust-lang/rust/assignees{/user}","branches_url":"https://api.github.com/repos/rust-lang/rust/branches{/branch}","tags_url":"https://api.github.com/repos/rust-lang/rust/tags","blobs_url":"https://api.github.com/repos/rust-lang/rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rust-lang/rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rust-lang/rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/rust-lang/rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rust-lang/rust/statuses/{sha}","languages_url":"https://api.github.com/repos/rust-lang/rust/languages","stargazers_url":"https://api.github.com/repos/rust-lang/rust/stargazers","contributors_url":"https://api.github.com/repos/rust-lang/rust/contributors","subscribers_url":"https://api.github.com/repos/rust-lang/rust/subscribers","subscription_url":"https://api.github.com/repos/rust-lang/rust/subscription","commits_url":"https://api.github.com/repos/rust-lang/rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/rust-lang/rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/rust-lang/rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/rust-lang/rust/issues/comments{/number}","contents_url":"https://api.github.com/repos/rust-lang/rust/contents/{+path}","compare_url":"https://api.github.com/repos/rust-lang/rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rust-lang/rust/merges","archive_url":"https://api.github.com/repos/rust-lang/rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rust-lang/rust/downloads","issues_url":"https://api.github.com/repos/rust-lang/rust/issues{/number}","pulls_url":"https://api.github.com/repos/rust-lang/rust/pulls{/number}","milestones_url":"https://api.github.com/repos/rust-lang/rust/milestones{/number}","notifications_url":"https://api.github.com/repos/rust-lang/rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rust-lang/rust/labels{/name}","releases_url":"https://api.github.com/repos/rust-lang/rust/releases{/id}","deployments_url":"https://api.github.com/repos/rust-lang/rust/deployments","created_at":"2010-06-16T20:39:03Z","updated_at":"2016-12-13T02:37:16Z","pushed_at":"2016-12-13T03:38:22Z","git_url":"git://github.com/rust-lang/rust.git","ssh_url":"git@github.com:rust-lang/rust.git","clone_url":"https://github.com/rust-lang/rust.git","svn_url":"https://github.com/rust-lang/rust","homepage":"https://www.rust-lang.org","size":535211,"stargazers_count":19343,"watchers_count":19343,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3714,"mirror_url":null,"open_issues_count":2985,"forks":3714,"open_issues":2985,"watchers":19343,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/38165"},"html":{"href":"https://github.com/rust-lang/rust/pull/38165"},"issue":{"href":"https://api.github.com/repos/rust-lang/rust/issues/38165"},"comments":{"href":"https://api.github.com/repos/rust-lang/rust/issues/38165/comments"},"review_comments":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/38165/comments"},"review_comment":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/38165/commits"},"statuses":{"href":"https://api.github.com/repos/rust-lang/rust/statuses/ddfef1515af456ae315531516d0c88f9721c0816"}}}}
{"actor":{"display_login":"Yamakaky"}}