-
Notifications
You must be signed in to change notification settings - Fork 13.3k
option to reverse the order of compile error messages #32650
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
Comments
That could be a nice simple solution to this problem. We've also discussed outputing to a pager of some kind to help you scroll through the errors. |
Nominating for discussion. @rust-lang/compiler @jonathandturner @GuillaumeGomez this is conceptually quite simple to do. Do we want to write up the tasks and ask for contributions? |
cc @rust-lang/tools too I'm a little wary about this, although it is small in itself, I can imagine we then end up adding paging options or other error display stuff to the compiler and end up with a pile of command line options, etc. I'd prefer that the compiler just offers a single best-effort error message presentation style, and if you want something else, you run the compiler through an external tool (command-line or otherwise) that takes JSON errors as input and outputs errors in whatever format you like. |
My feelings on this are close to @nrc's.
Perhaps we could settle on adding rustc parameter to suppress errors beyond the first N? |
You could do what Git does and automatically send output longer than the number of rows on the terminal to |
To pile on a "me too" to @nrc and @vadimcn - it'd be much better to use a second tool to turn the output from the compiler into what you want. There some precedence, like tools like dybuk do their own parsing and recreating the errors. I can imagine a tool that reads in the errors and then replays them backward as another one. |
Worth mentioning, too, that the errors are streamed rather than buffered. That's to give feedback sooner rather than forcing the programmer to wait. As we add more error recovery to the compiler, it will likely mean longer wait times before you see an error if you buffer until the compile finishes because the compiler will be able to recover and go for longer in the presence of errors. |
I'm much more in favor of using a pager; but I guess that doesn't help with |
I’m very against using any sort of pager. Any proper terminal emulator is already as functional or more functional than your average pager, why cripple that? Perhaps a simpler solution is to not use rustc in getty? |
@nagisa presumably you could control it in whatever way e.g. git lets you control it. But a pager has a lot of advantages. For example, you see the first error... first. If you have to page-up as in a "proper" terminal emulator, that's annoying, because you can easily page up into older errors. If your terminal emulator is so fancy as to somehow jump to the top of the current rustc run, that's great, but many people are just using Terminal.app or whatever. |
We discussed this in the @rust-lang/compiler meeting, so I'm removing the nominated tag -- there was not a lot of enthusiasm, for the reasons that have been presented on the thread already (e.g. by @nrc). |
Since there's little change of this enhancement happening I'm just closing. |
So what is the recommended way of dealing with this problem now? Off Topic: |
@fdietze I recommend running the output of the compiler through a tool to get the output you want. Exactly which tool depends on what you want - but something as simple as |
I just had this idea while scrolling upwards in my terminal to find the first compile error:
It would be nice to have the option to print the compile errors in reverse order, then one sees the most relevant error at a first glance. This would be especially helpful when using cargo-watch.
(I'm posting this here, because this is not a language RFC, was that correct?)
The text was updated successfully, but these errors were encountered: