{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/27189","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/27189/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/27189/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/27189/events","html_url":"https://github.com/rust-lang/rust/issues/27189","id":96351124,"number":27189,"title":"Add `rustc --fatal` which stops at the first build error","user":{"login":"SimonSapin","id":291359,"avatar_url":"https://avatars.githubusercontent.com/u/291359?v=3","gravatar_id":"","url":"https://api.github.com/users/SimonSapin","html_url":"https://github.com/SimonSapin","followers_url":"https://api.github.com/users/SimonSapin/followers","following_url":"https://api.github.com/users/SimonSapin/following{/other_user}","gists_url":"https://api.github.com/users/SimonSapin/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonSapin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonSapin/subscriptions","organizations_url":"https://api.github.com/users/SimonSapin/orgs","repos_url":"https://api.github.com/users/SimonSapin/repos","events_url":"https://api.github.com/users/SimonSapin/events{/privacy}","received_events_url":"https://api.github.com/users/SimonSapin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-07-21T15:48:03Z","updated_at":"2015-07-21T17:14:39Z","closed_at":null,"body":"(Should this be an RFC?)\r\n\r\n## Motivation\r\n\r\nWhen refactoring, one may have dozens or hundreds of build errors which need to be fixed one by one. Sometimes, a build error is only a consequence of an earlier error rather than something that need to be fixed itself:\r\n\r\n```rust\r\nlet foo = bar.method_that_was_renamed(); // First error\r\n// ...\r\nbar.other_method() // Second error because the type of `bar` is unknown\r\n```\r\n\r\nIn such cases, it is a better strategy to start by looking at and fixing earlier errors (in the compiler output) first. The second error might just go away when the first is fixed.\r\n\r\nIn a large enough crate, it’s easy to get well over one screenful of compiler output. So the workflow is something like:\r\n\r\n* Build. See lots of output be generated too fast to read.\r\n* Scroll back to the beginning of the output for this build. Don’t miss it! It looks a lot like the output of the previous build.\r\n* Find the first error.\r\n* Try to fix the first error.\r\n* Repeat.\r\n\r\n## Proposal\r\n\r\nAdd a command-line argument to rustc, called something like `--fatal`. When it is given and the compile finds a build error (the kind that would cause the compilation to fail eventually, so not warnings), exit immediately after printing diagnostics for this error. This is the opposite of the usual strategy of finding as many errors as possible at once.\r\n\r\nThe new workflow is:\r\n\r\n* Build.\r\n* The first error is right there at the bottom of the terminal. A single error likely fits entirely on the screen.\r\n* Try to fix it.\r\n* Repeat.\r\n\r\n(With some [inotify-based tricks](https://exyr.org/2011/inotify-run/), it’s not even necessary to switch focus from the terminal.)"},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/123406186","html_url":"https://github.com/rust-lang/rust/issues/27189#issuecomment-123406186","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/27189","id":123406186,"user":{"login":"arielb1","id":1830974,"avatar_url":"https://avatars.githubusercontent.com/u/1830974?v=3","gravatar_id":"","url":"https://api.github.com/users/arielb1","html_url":"https://github.com/arielb1","followers_url":"https://api.github.com/users/arielb1/followers","following_url":"https://api.github.com/users/arielb1/following{/other_user}","gists_url":"https://api.github.com/users/arielb1/gists{/gist_id}","starred_url":"https://api.github.com/users/arielb1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arielb1/subscriptions","organizations_url":"https://api.github.com/users/arielb1/orgs","repos_url":"https://api.github.com/users/arielb1/repos","events_url":"https://api.github.com/users/arielb1/events{/privacy}","received_events_url":"https://api.github.com/users/arielb1/received_events","type":"User","site_admin":false},"created_at":"2015-07-21T17:14:39Z","updated_at":"2015-07-21T17:14:39Z","body":"@SimonSapin \r\n\r\nI don't think error cascades are a significant problem with rustc - mostly \"the type of this value must be known\" and bogus regionck errors. I don't think there's a better way of limiting the number of error lines than `rustc ARGS --color=always 2>&1 | head -n100` (we should have a way of accessing this via cargo, that's it other than ` $(echo $(tr '\\0' ' ' < /proc/`pgrep rustc | head -n1`/cmdline) --color=always) 2>&1 | head -n10`."}}