Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rustc --fatal which stops at the first build error #27189

Closed
SimonSapin opened this issue Jul 21, 2015 · 43 comments
Closed

Add rustc --fatal which stops at the first build error #27189

SimonSapin opened this issue Jul 21, 2015 · 43 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-frontend Area: frontend (errors, parsing and HIR) C-feature-request Category: A feature request, i.e: not implemented / a PR. D-verbose Diagnostics: Too much output caused by a single piece of incorrect code. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@SimonSapin
Copy link
Contributor

(Should this be an RFC?)

Motivation

When 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:

let foo = bar.method_that_was_renamed(); // First error
// ...
bar.other_method() // Second error because the type of `bar` is unknown

In 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.

In a large enough crate, it’s easy to get well over one screenful of compiler output. So the workflow is something like:

  • Build. See lots of output be generated too fast to read.
  • 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.
  • Find the first error.
  • Try to fix the first error.
  • Repeat.

Proposal

Add 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.

The new workflow is:

  • Build.
  • The first error is right there at the bottom of the terminal. A single error likely fits entirely on the screen.
  • Try to fix it.
  • Repeat.

(With some inotify-based tricks, it’s not even necessary to switch focus from the terminal.)

@brson
Copy link
Contributor

brson commented Jul 21, 2015

Maybe this should be the default - fixing a single error and recompiling is probably the most common workflow.

If errors are fatal (and this was default) it will exacerbate the frustration of not knowing how much progress you are making as you work through the errors. To disambiguate, this could continue counting errors without displaying them and terminate with '... and at least {} other errors, run with ... to display them'.

@pnkfelix
Copy link
Member

In the meantime, one can use -Z treat-err-as-bug today to get something like this effect.

(Of course that's a debugging option, i.e. inherently unstable, so we should still leave this ticket open.)

@pnkfelix
Copy link
Member

@brson there is also the potential problem that the actual error in the code that really needs to be fixed is not the first error that is signaled, but rather is flagged by some later error message that is emitted.

(Having said that, I'm not sure how often I encounter the latter scenario. I would need to gather statistics.)

@alexcrichton
Copy link
Member

I would personally not want this to be the default, I prefer to have as many errors as possible listed for me to fix. Sometimes I pipe the compiler into head -n 50, but that's pretty rare.

I think clang has an option for the maximum number of errors to be printed before it stops, and that seems like an option we'd want to have regardless anyway.

@SimonSapin
Copy link
Contributor Author

I agree this shouldn’t be the default. I’d only want this when there’s a really large number of errors.

Unfortunately piping into head (or anything) disables color in the output. An option to limit the number of errors printed (or better, the number of lines) would be good.

@arielb1
Copy link
Contributor

arielb1 commented Jul 21, 2015

@SimonSapin

I 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).

@nagisa
Copy link
Member

nagisa commented Jul 21, 2015

Note that our diagnostics infrastructure is not particularly adaptable for this request.

Consider a diagnostic which currently returns an error and associated help/hint message. Since these are printed via two different calls without any future hints, a naive implementation of --fatal would also drop the associated hints/helps too.

@steveklabnik steveklabnik added the A-frontend Area: frontend (errors, parsing and HIR) label Jul 22, 2015
@canndrew
Copy link
Contributor

Bump. I'd like this to be fixed aswell.

Also I think this behaviour should be default unless --verbose is specified. Specifically rustc should detect whether it's printing to a terminal; if so, count the number of rows and print however many errors will fit in the available space followed by '... and at least {} other errors ...'.

@sophiajt
Copy link
Contributor

Another 👍 from me. Possibly we might want a --limit-errors=3 or something (if we don't already).

@lilith
Copy link

lilith commented Nov 29, 2016

I'd like to have a timeout after the first error. I.e, provide all errors that are available within a certain number of milliseconds after the first error. We're interested in speed, right? Limiting the number of errors displayed is orthogonal.

For example, --errors-fatal-after=1500 would ensure that the cargo/rustc process tree ends no later than 1500ms after reporting the first error. With large crates the process can continue for 20 seconds or more after reporting the first error, and this can affect workflow with tools like IntelliJ-Rust.

The upside is that this should be pretty easy to implement - perhaps even possible as a wrapper executable.

@canndrew
Copy link
Contributor

canndrew commented Dec 1, 2016

We're interested in speed, right? Limiting the number of errors displayed is orthogonal.

For me it's about not wanting to scroll up my terminal to find the top of the errors. Just giving the first few is enough, especially since fixing those is often enough to fix all the other errors.

@jonhoo
Copy link
Contributor

jonhoo commented Dec 1, 2016

This could also be helpful for those of us building projects in the background in our editors to show errors. neomake/neomake#801 (comment) is a rather crude workaround (using the timeout command).

@torkleyy
Copy link

torkleyy commented Mar 1, 2017

I also think that when refactoring it's very annoying to have hundreds of errors, however I'd more like something like a "stop after x errors" because a single error would slow down development (you had to compile pretty often). If it should be default, I'd probably stop after 10 errors because more than 10 are most likely not useful.

@sunjay
Copy link
Member

sunjay commented Mar 4, 2017

Does something like this exist now? I'm refactoring some code and it would be great to just see one or two errors at a time. The large amount of compiler errors is a bit much to deal with.

@SimonSapin
Copy link
Contributor Author

@sunjay On Linux or OS X you can use something like: cargo build --color=always 2>&1 | head -n 40. The head comment limits the output to the given number of lines (40 works well for me). 2>&1 | means that we get both stdout and stderr of cargo piped into head. Finally we tell Cargo to use ANSI color codes in its output (and to tell rustc to do the same) even though the output doesn’t look like a terminal (since it’s a pipe).

@richardjharris
Copy link

richardjharris commented Apr 4, 2017

I'm using cargo build --color=always 2>&1 | less -R which allows both instant viewing of the first error, and also scrolling down to see the rest.

I would prefer cargo did what git does - automatically open a pager if the errors exceed the height of the window. Beginner rust development is usually either no errors or 30+ errors that share a single root cause.

@SimonSapin
Copy link
Contributor Author

FWIW, the reason I don’t use a page is that it has to be exited manually. I also use an inotify-based script (similar to "cargo watch") to recompile automatically when a source file changes, so I only have to save from my editor to start a new compilation, no need to switch focus to the terminal. I imagine the inotify thing could be a background task that would kill the pager when it’s time to recompile, but that seems more tricky and fragile.

@caedn
Copy link

caedn commented Apr 30, 2017

At least on macOS (zsh) I do lose the color with cargo run --color=always 2>&1|head -n20. That is for everything that was stderr and is being redirected to stdout. Same with bash.

I also tried the zsh exclusive cargo run --color=always |& head -n20, with the same results.

I really hope we'll get a --limit-errors=n flag. Using head also stops the output mid error message (depending on how long they are and the -n flag) and feels like a hack. I don't like using less because I can't use something like entr to watch for file changes with it.

@Mark-Simulacrum Mark-Simulacrum added the C-feature-request Category: A feature request, i.e: not implemented / a PR. label Jul 22, 2017
@Mark-Simulacrum Mark-Simulacrum marked this as a duplicate of #34225 Jul 25, 2017
@marmistrz
Copy link
Contributor

Well, while working on lifetimed handles, I killed the build process after 10 minutes of printing errors.

@marmistrz
Copy link
Contributor

A workaround, which takes advantage of the fact that most processes are killed by SIGPIPE is:

./mach build --dev --color=always 2>&1 | head -n 30

@aeyakovenko
Copy link

Woot! also works with cargo watch!

cargo watch -x 'test --color=always 2>&1 | head -n 50' 

@kirhgoff
Copy link

kirhgoff commented Apr 9, 2019

The other ticket is also closed as duplicated. Wonder is it that complicated to implement that option.

@Benjamin-L
Copy link
Contributor

I played around with trying to implement this yesterday, with no success. I don't really understand how the diagnostics system is structured though, so somebody with more experience with it will probably have more luck.

I did, however, write an awk script that does pretty much the same thing:

cargo watch -x "build --color=always 2>&1 | awk '/error.*:/{n++};n < 2'"

Replace 2 with the number of errors you want to stop on. In this case, it stops on the second, so only prints the first.

@ghost
Copy link

ghost commented Jul 10, 2019

That workaround is still true today:

    -Z               treat-err-as-bug=val -- treat error number `val` that occurs as bug

all it does is just call panic!() when the error number is == val
this shouldn't cause any delays unless RUST_BACKTRACE env. var. is set to 1 or full.

src/librustc_errors/lib.rs

      fn bump_err_count(&self) {
          self.err_count.fetch_add(1, SeqCst);
          self.panic_if_treat_err_as_bug();                                                                                     
      }

      fn panic_if_treat_err_as_bug(&self) {                                                                                     
          if self.treat_err_as_bug() {
              let s = match (self.err_count(), self.flags.treat_err_as_bug.unwrap_or(0)) {
                  (0, _) => return,
                  (1, 1) => "aborting due to `-Z treat-err-as-bug=1`".to_string(),
                  (1, _) => return,
                  (count, as_bug) => {
                      format!( 
                          "aborting after {} errors due to `-Z treat-err-as-bug={}`",
                          count,
                          as_bug,
                      )
                  }
              };
              panic!(s);
          }   
      }   

example:
cargo rustc --color=always -v --no-default-features -- -Z treat-err-as-bug=1 -v

     Running `rustc --edition=2018 --crate-name getuniqid3 /home/user/build/2nonpkgs/rust.stuff/plaincatchup/getuniqid3/src/main.rs --color always --crate-type bin --emit=dep-info,link -C codegen-units=16 -C debuginfo=2 -Z treat-err-as-bug=1 -v -C metadata=6c1f7a137011ccf1 -C extra-filename=-6c1f7a137011ccf1 --out-dir /home/user/build/2nonpkgs/rust.stuff/plaincatchup/target/debug/deps -C incremental=/home/user/build/2nonpkgs/rust.stuff/plaincatchup/target/debug/incremental -L dependency=/home/user/build/2nonpkgs/rust.stuff/plaincatchup/target/debug/deps -C target-cpu=native`
error: Must use at least one of the features: uuid, rand
  --> /home/user/build/2nonpkgs/rust.stuff/plaincatchup/getuniqid3/src/main.rs:11:1
   |
11 | compile_error!("Must use at least one of the features: uuid, rand");
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

thread '<unnamed>' panicked at 'aborting due to `-Z treat-err-as-bug=1`', src/librustc_errors/lib.rs:547:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.37.0-dev (fd7f48b3e 2019-06-30) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z treat-err-as-bug=1 -C codegen-units=16 -C debuginfo=2 -C incremental -C target-cpu=native --crate-type bin

note: some of the compiler flags provided by cargo are hidden

error: Could not compile `getuniqid3`.

Caused by:
  process didn't exit successfully: `rustc --edition=2018 --crate-name getuniqid3 /home/user/build/2nonpkgs/rust.stuff/plaincatchup/getuniqid3/src/main.rs --color always --crate-type bin --emit=dep-info,link -C codegen-units=16 -C debuginfo=2 -Z treat-err-as-bug=1 -v -C metadata=6c1f7a137011ccf1 -C extra-filename=-6c1f7a137011ccf1 --out-dir /home/user/build/2nonpkgs/rust.stuff/plaincatchup/target/debug/deps -C incremental=/home/user/build/2nonpkgs/rust.stuff/plaincatchup/target/debug/incremental -L dependency=/home/user/build/2nonpkgs/rust.stuff/plaincatchup/target/debug/deps -C target-cpu=native` (exit code: 101)

or can put it in ~/.cargo/config:

[target.'cfg(any(windows, unix))']
rustflags = ["-C", "target-cpu=native", "-Z", "treat-err-as-bug=1"]   

and then just run as normal:
cargo build --color=always -v --no-default-features --

     Running `rustc --edition=2018 --crate-name getuniqid3 /home/user/build/2nonpkgs/rust.stuff/plaincatchup/getuniqid3/src/main.rs --color always --crate-type bin --emit=dep-info,link -C codegen-units=16 -C debuginfo=2 -C metadata=c436d7357fcd2094 -C extra-filename=-c436d7357fcd2094 --out-dir /home/user/build/2nonpkgs/rust.stuff/plaincatchup/target/debug/deps -C incremental=/home/user/build/2nonpkgs/rust.stuff/plaincatchup/target/debug/incremental -L dependency=/home/user/build/2nonpkgs/rust.stuff/plaincatchup/target/debug/deps -C target-cpu=native -Z treat-err-as-bug=1`
error: Must use at least one of the features: uuid, rand
  --> /home/user/build/2nonpkgs/rust.stuff/plaincatchup/getuniqid3/src/main.rs:11:1
   |
11 | compile_error!("Must use at least one of the features: uuid, rand");
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

thread '<unnamed>' panicked at 'aborting due to `-Z treat-err-as-bug=1`', src/librustc_errors/lib.rs:547:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.37.0-dev (fd7f48b3e 2019-06-30) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z treat-err-as-bug=1 -C codegen-units=16 -C debuginfo=2 -C incremental -C target-cpu=native --crate-type bin

note: some of the compiler flags provided by cargo are hidden

error: Could not compile `getuniqid3`.

Caused by:
  process didn't exit successfully: `rustc --edition=2018 --crate-name getuniqid3 /home/user/build/2nonpkgs/rust.stuff/plaincatchup/getuniqid3/src/main.rs --color always --crate-type bin --emit=dep-info,link -C codegen-units=16 -C debuginfo=2 -C metadata=c436d7357fcd2094 -C extra-filename=-c436d7357fcd2094 --out-dir /home/user/build/2nonpkgs/rust.stuff/plaincatchup/target/debug/deps -C incremental=/home/user/build/2nonpkgs/rust.stuff/plaincatchup/target/debug/incremental -L dependency=/home/user/build/2nonpkgs/rust.stuff/plaincatchup/target/debug/deps -C target-cpu=native -Z treat-err-as-bug=1` (exit code: 101)

@ghost
Copy link

ghost commented Jul 17, 2019

Ok, I found (at least) one case where -Z treat-err-as-bug=1 will make you miss the actual error, as someone already mentioned above it could happen.

For this case:

[package]
name = "bad_Z"
version = "0.1.0"
authors = ["howaboutsynergy <howaboutsynergy@pm.me>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

[features]
bad = [] 
fn main() {
    println!(
        "Hello, world! {}",
        #[cfg(not(feature = "bad"))]
        "arg when not bad",
        #[cfg(feature = "bad")]
        "arg when bad",
    );
}

Compiler output when -Z treat-err-as-bug=1 via $ time cargo rustc --verbose --release -- -Z treat-err-as-bug=1 -v "$@":

error: argument never used
 --> /home/user/build/2nonpkgs/rust.stuff/plaincatchup/bad_Z/src/main.rs:7:9
  |
3 |         "Hello, world! {}",
  |         ------------------ formatting specifier missing
...
7 |         "arg when bad",
  |         ^^^^^^^^^^^^^^ argument never used

thread '<unnamed>' panicked at 'aborting due to `-Z treat-err-as-bug=1`', src/librustc_errors/lib.rs:546:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.38.0-dev (e7efdf1c3 2019-07-09) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z treat-err-as-bug=1 -C opt-level=3 -C lto -C codegen-units=1 -C debug-assertions=on -C target-cpu=native --crate-type bin

note: some of the compiler flags provided by cargo are hidden

error: Could not compile `bad_Z`.

Normal compiler output:

error: argument never used
 --> /home/user/build/2nonpkgs/rust.stuff/plaincatchup/bad_Z/src/main.rs:7:9
  |
3 |         "Hello, world! {}",
  |         ------------------ formatting specifier missing
...
7 |         "arg when bad",
  |         ^^^^^^^^^^^^^^ argument never used

error[E0658]: attributes on expressions are experimental
 --> /home/user/build/2nonpkgs/rust.stuff/plaincatchup/bad_Z/src/main.rs:4:9
  |
4 |         #[cfg(not(feature = "bad"))]
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: for more information, see https://github.com/rust-lang/rust/issues/15701
  = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable

error: removing an expression is not supported in this position
 --> /home/user/build/2nonpkgs/rust.stuff/plaincatchup/bad_Z/src/main.rs:4:9
  |
4 |         #[cfg(not(feature = "bad"))]
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0658]: attributes on expressions are experimental
 --> /home/user/build/2nonpkgs/rust.stuff/plaincatchup/bad_Z/src/main.rs:6:9
  |
6 |         #[cfg(feature = "bad")]
  |         ^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: for more information, see https://github.com/rust-lang/rust/issues/15701
  = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable

error: removing an expression is not supported in this position
 --> /home/user/build/2nonpkgs/rust.stuff/plaincatchup/bad_Z/src/main.rs:6:9
  |
6 |         #[cfg(feature = "bad")]
  |         ^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 5 previous errors

For more information about this error, try `rustc --explain E0658`.
error: Could not compile `bad_Z`.

@vhnatyk
Copy link

vhnatyk commented Aug 7, 2019

so annoying to have hundreds of errors go for no reason, each time scroll down/up, wait few minutes on the compilation. I understand there are some ugly workarounds on Linux, but on Windows? It's so straight forward not to compile after few - so upset 👎 😭

@jonas-schievink jonas-schievink added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 5, 2020
@alopatindev
Copy link
Contributor

alopatindev commented Sep 13, 2020

Here's a workaround: the default limit is 1, error messages come first. Tested on GNU/Linux, probably works on Windows and macOS as well.

@saethlin
Copy link
Member

Incremental improvement on the pipelines posted above:

cargo watch -x "build --color=always 2>&1 | less -CR"

@Fishrock123
Copy link
Contributor

Fwiw: It would be nice if compile_error! (or something similar) could be "compile fatal" without additional flags.

@Stuffe
Copy link

Stuffe commented Nov 9, 2020

Maybe a compromise would be to order the errors in reverse, so the people who fix one error at a time dont have to scroll so much. Coming from other languages, I notice the constant scrolling really slows down my work flow

@kevincox
Copy link
Contributor

kevincox commented Nov 9, 2020

That seems like a hack but I'll take anything at this point 😅

@kevincox
Copy link
Contributor

kevincox commented Nov 9, 2020

error: expected `;`, found `RedditSearch`
  --> src/main.rs:24:22
   |
24 |         let state = State{}
   |                            ^ help: add `;` here
25 | 
26 |         RedditSearch{}.start();
   |         ------------ unexpected token

error: expected `;`
  --> src/main.rs:26:3
   |
26 |         RedditSearch{}.start();
   |         ^^^^^^^^^^^^

error[E0601]: `main` function not found in crate `webmentioner`
  --> src/main.rs:1:1
   |
1  | / pub use actix::Actor as _;
2  | |
3  | | mod reddit; pub use reddit::*;
4  | |
...  |
39 | |     system.await
40 | | }
   | |_^ consider adding a `main` function to `src/main.rs`

An example of a useless second error, I do have a main function, but because I forgot a semicolon rustc flips out. Now I need to read the error and realize it isn't an error before finding the actual issue. It would be so much easier if an actionable error was at the bottom of my terminal. This is legitimately my biggest complaint about rust. Very often the later errors are not problems at all, or are at least made more clear by fixing the earlier errors. I understand that some people like batch fixing errors but I definitely prefer the iterative style. This feature would help me stay focused on the errors that matter, instead of having to scroll around constantly.

@kevincox
Copy link
Contributor

kevincox commented Oct 6, 2021

I spent a bunch of time today trying to figure out why a struct was missing from a library when docs.rs says that it exists. I checked the docs, double checked the version and if any features were required. Then I realized that it was just Rust making stuff up about a dependency that I forgot to install because apparently more errors is more helpful.

error[E0433]: failed to resolve: use of undeclared crate or module `password_hash`
   --> src/crypto.rs:123:13
    |
123 |     let salt = password_hash::SaltString::generate(&mut rand_core::OsRng);
    |                ^^^^^^^^^^^^^ use of undeclared crate or module `password_hash`

error[E0433]: failed to resolve: use of undeclared crate or module `password_hash`
   --> src/crypto.rs:124:20
    |
124 |     Ok(password_hash::PasswordHasher
    |                       ^^^^^^^^^^^^^^ not found in `password_hash`
    |
help: consider importing this trait
    |
3   | use argon2::PasswordHasher;
    |

error[E0433]: failed to resolve: use of undeclared crate or module `password_hash`
   --> src/crypto.rs:137:20
    |
137 |     Ok(password_hash::PasswordHash::new(&hash)?
    |                       ^^^^^^^^^^^^ not found in `password_hash`
    |
help: consider importing this struct
    |
3   | use argon2::PasswordHash;
    |

@estebank estebank added A-diagnostics Area: Messages for errors, warnings, and lints D-verbose Diagnostics: Too much output caused by a single piece of incorrect code. labels Feb 8, 2023
@gilescope
Copy link
Contributor

There is ograc which is cargo in reverse as a tool that can help a bit, but I agree it's really annoying that I can't limit the number of cargo errors easily.

@SimonSapin
Copy link
Contributor Author

For what it’s worth tooling has changed a lot since I filed this in 2015. These days I use VSCode with rust-analyzer, the dedicated error pane fixes all the pain points described here for me (and allows quickly navigating an editor to relevant code).

Since nothing concrete happened from this issue in all these years, I’m gonna make a judgment call and close it.

I suspect some folks would still like something to be added here, if someone wants to champion it I recommend pushing a proposal through the compiler team’s process: https://forge.rust-lang.org/compiler/new_option.html

@SimonSapin SimonSapin closed this as not planned Won't fix, can't repro, duplicate, stale Mar 1, 2023
@kevincox
Copy link
Contributor

kevincox commented Mar 1, 2023

I appreciate that you may no longer be interested but there are still other users who are. Could you please reopen this so that we can continue to track progress (or lack there of) in the same place?

If you are no longer interested in receiving notifications you can unsubscribe from this issue using the button on the issue page or the link in the email.

While many users are using IDE error messages lots of us still use a separate compiler for one reason or another (personally it makes my edit and run loop much easier as all of my output is in the same place). So for now this seems like a relatively easy mitigation to the problem of the tons of false-positive errors that are generated by the compiler. (I'm not holding my breath for the root cause to be fixed). So I think it makes sense to leave this open as a specific feature request with direct benefits to the productivity of many Rust users.

@Keavon
Copy link

Keavon commented Mar 1, 2023

Please don't close this! There are many of us still desperate for this feature, even if you've personally lost interest. Feel free to unsubscribe from notifications after you reopen it if you're no longer interested.

@SimonSapin
Copy link
Contributor Author

SimonSapin commented Mar 2, 2023

reopen this so that we can continue to track progress (or lack there of)

That’s the thing: there won’t be any progress until someone care enough to make it happen. So far nobody has cared enough in 8 years. If and when they do, this issue won’t serve a purpose anyway since the compiler team’s (relatively) new process involves a Major Change Proposal filed in another repo.

By the way the MCP should be more concrete than what we have here: is it a new CLI option for rustc? Also Cargo? What does it do exactly? Isn’t an auto-pager like git a better idea? Etc.

Does "desperate" mean willing to do the work?

@alopatindev
Copy link
Contributor

alopatindev commented Mar 4, 2023

By the way the MCP should be more concrete than what we have here: is it a new CLI option for rustc? Also Cargo? What does it do exactly? Isn’t an auto-pager like git a better idea? Etc.

Such Similar, even better, CLI option already exists, it's RUSTFLAGS="-A warnings", but it causes project recompilation, probably for no good reason, which makes this flag completely useless, at least for middle size code base projects. This might be just a bug and I'm not sure whether it's hard to fix it without breaking something else.

Alternative is probably much harder to implement: just have smarter compiler messages by default, no additional CLI options are needed. There are some cases when it might makes sense to see both errors and warnings in the same compiler output, but in many cases such warnings are just useless consequences of the errors, which steal our attention a lot. Is there any way to detect useless messages and ignore them?

For other insights and for anyone who suffer from this issue — please check out these few ideas in this dirty limited workaround I mentioned before. Thanks.

Does "desperate" mean willing to do the work?

For me specifically it means the following: please notice the issue and workaround for it, which exists there with a hope to give compiler team and anyone concerned some inspiration on how it can be fixed in the compiler/cargo; and yes far few of us can invest time in going through all the bureaucratic procedure of introducing MCP/RFC/etc. and all this, life is too short, but it doesn't mean this issue is not important and should be just ignored.

@nevali
Copy link

nevali commented Nov 20, 2023

So far nobody has cared enough in 8 years. If and when they do, this issue won’t serve a purpose anyway since the compiler team’s (relatively) new process involves a Major Change Proposal filed in another repo.

can i just check i'm understanding correctly?

the compiler team has invented a process (which nobody who doesn't actively develop Rust will know anything about), and which involves ignoring issues and feature requests filed by end-users against the official project repo? and that's on… the end-users? okay cool.

@SimonSapin
Copy link
Contributor Author

Nothing in "on" end users. Things happen when a contributor wants to push a particular thing forward. I close this issue as the end user who initially filed it, because I no longer think it’s a good idea.

@kevincox
Copy link
Contributor

I appreciate that you no longer think that it is a good idea but apparently there are 80 other people who still think it is. So closing the discussion for everyone is not very polite and makes the discussion history difficult to follow if someone needs to open a separate issue.

@vhnatyk
Copy link

vhnatyk commented Dec 8, 2023

so ugly it's not an option after all these years - so inconvenient 😞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-frontend Area: frontend (errors, parsing and HIR) C-feature-request Category: A feature request, i.e: not implemented / a PR. D-verbose Diagnostics: Too much output caused by a single piece of incorrect code. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests