Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upError Message Overhaul #33240
Comments
nikomatsakis
referenced this issue
Apr 27, 2016
Merged
Overhaul borrowck error messages and compiler error formatting generally #32756
This comment has been minimized.
This comment has been minimized.
|
For anyone who want to play around with ideas related to the error formatting, you can use this. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Could you add the following?
|
This comment has been minimized.
This comment has been minimized.
We'd talked some about maybe a "customization of error colors". What do you mean by error formatting?
Because we want errors to look and feel similar across platforms, the idea here is to pick a way to display the error that's friendly to even non-unicode environments (like default Windows). We can definitely revisit this one if modern Windows improvements, like Bash on Windows for example, open up the door to using more Unicode.
Oh right. Yeah, that could look good, depending on how we do it. Would be fun to experiment. |
This comment has been minimized.
This comment has been minimized.
I worked on it a while ago for
I'm not sure to understand the issue here. Aren't they translated as whitespaces? |
This comment has been minimized.
This comment has been minimized.
|
@GuillaumeGomez the tabs issue is around treating the amount of space we print the tab the same as the amount of space we need to move under the source code to start underlining. The old code had some logic in there to line them up and we just need to port it over. |
This comment has been minimized.
This comment has been minimized.
|
Ok, so it's a port issue. Thanks for the explanation @jonathandturner! |
This comment has been minimized.
This comment has been minimized.
mhintz
commented
Apr 27, 2016
|
One thing that nags me a lot is the amount of space between distinct error messages in the printed console output. Often, because of whitespace in individual error messages, there is more visual whitespace within messages than between distinct ones. This makes it difficult, when scanning printed console output, to visually distinguish different messages, which makes fast visual parsing of the compiler output tricky. When coupled with the fact that rustc often generates several error messages at once, some of which are follow-ons from one original message appearing at the top of the output, I often find myself scrolling upwards through a column of hard-to-scan text looking for a hard-to-spot relevant message. A more clearly formatted beginning of the compiler output and clearer delineation between individual error messages would help a lot. Thanks! |
This comment has been minimized.
This comment has been minimized.
|
@mhintz Do you have an example of the spacing issue you're talking about? Also, is this an issue with the previous error message style or the new message style? |
This comment has been minimized.
This comment has been minimized.
Well, making it possible to define the escapes introducing the various labels.
I thought about using a loosly coloured scheme, to avoid confusion with the labels otherwhere. |
This comment has been minimized.
This comment has been minimized.
|
Enum variants are associated items, which has some potentially surprising consequences if you attempt to access them through a A better error, I think, would be something like |
This comment has been minimized.
This comment has been minimized.
|
@ketsuban Wrong thread? |
This comment has been minimized.
This comment has been minimized.
|
No?
My issue was about an error message which isn't very clear, so I posted it here to garner attention since this is an issue for bringing attention to unhelpful error messages. |
This comment has been minimized.
This comment has been minimized.
mhintz
commented
Apr 27, 2016
|
@jonathandturner Just scrolled through the history over at #32756 and it looks like that PR takes care of my objection about spacing, by reformatting and separating nightly's current output. I also hadn't known about the Dybuk formatter, which looks pretty good (maybe even better than the PR). I assumed it wasn't on the radar, since it hasn't been merged into nightly yet, and I saw the rustlang Twitter account post about it. Glad it's being worked on! |
This comment has been minimized.
This comment has been minimized.
I am sort of undecided about whether we want these. Customization is
But this would be nice. |
This comment has been minimized.
This comment has been minimized.
|
I think that for syntax highlighting, I'd prefer to just find keywords and highlight them in bold (something very minimal). We have to be very wary of drawing attention away. |
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis: More or less than this? |
This comment has been minimized.
This comment has been minimized.
|
Is #31173 covered here? |
This comment has been minimized.
This comment has been minimized.
danielpclark
commented
Apr 27, 2016
|
Wish this thread was open a few weeks ago. I once had an error message give me a |
bors
added a commit
that referenced
this issue
Apr 28, 2016
This comment has been minimized.
This comment has been minimized.
|
Earlier I wrote:
Ever since I wrote this, the wording I used has been bugging me. Even though I still more-or-less feel the same, I feel like saying this is a "niche" request sounds dismissive, which I did not intend. Let me just clarify that what I meant is that I suspect that it's a feature that few would take advantage of, and I'd be happiest if we can just find one output that everyone is relatively satisfied with. |
NotaseCretagen
referenced this issue
Apr 28, 2016
Closed
Feature request: clickable line numbers in error message to jump to the code in editor. #159
bors
added a commit
that referenced
this issue
Apr 30, 2016
bors
added a commit
that referenced
this issue
Apr 30, 2016
bors
added a commit
that referenced
this issue
Apr 30, 2016
Manishearth
added a commit
to Manishearth/rust
that referenced
this issue
May 2, 2016
Manishearth
added a commit
to Manishearth/rust
that referenced
this issue
May 2, 2016
bors
added a commit
that referenced
this issue
May 2, 2016
eddyb
added a commit
to eddyb/rust
that referenced
this issue
May 13, 2016
eddyb
added a commit
to eddyb/rust
that referenced
this issue
May 13, 2016
bors
added a commit
that referenced
this issue
May 13, 2016
jonathandturner
referenced this issue
May 13, 2016
Closed
Error message for wrong number of arguments to a closure is bad #21857
This comment has been minimized.
This comment has been minimized.
rrichardson
commented
Jun 6, 2016
|
Someone posted this into #rust and we solved the problem, but still pondered over the error: Nightly on playpen, but same result (different formatting) on 1.8 or beta. use std::io;
use std::sync::{Arc, RwLock};
use std::thread::{Builder as ThreadBuilder, JoinHandle};
fn main() {
let data = vec!["I am data!".to_string()];
let data_lock = Arc::new(RwLock::new(data));
thread(data_lock.clone())
.map(|t| t.join().expect("Thread failed"))
.expect("Thread creation failed");
}
fn thread(lock: Arc<RwLock<Vec<String>>>) -> io::Result<JoinHandle<()>> {
let thread_lock = lock.clone();
ThreadBuilder::new()
.spawn(move || {
match thread_lock.read() { // line 20
Ok(data) => {
data.iter()
.map(|s| println!("{}", s))
.collect::<Vec<_>>();
},
_ => (),
} // line 26
})
}
This is solved by adding a semicolon to the end of the match block on line 26. I'm not entirely sure what's going on here, I am guessing that the semicolon ensures that the result of the match doesn't try to be returned from the scope of the closure(?) even though the result of the match doesn't contain anything from thread_lock, it is (). |
This comment has been minimized.
This comment has been minimized.
|
@rrichardson that problem sounds lik it is due to the temporary lifetimes; in this case the |
steveklabnik
added
the
A-diagnostics
label
Jul 25, 2016
This comment has been minimized.
This comment has been minimized.
|
Oh good, now even more stuff is using the difficult to read blue text. (Also the help text isn't formatted in bright cyan the way help messages are supposed to be) Come on, good defaults are really important! Also, the Windows Console doesn't support bold, so I'd really appreciate it if instead you simply used white. Note that regular text is light gray by default, not white, so white would be the perfect choice here, making the text brighter and stand out, just like bold would. Even with good defaults, I'd still really appreciate it if rustc had a way for me to choose which colors it uses for which thing. That way I can choose a nice palette of colors in my console and then tell rustc to use those colors. |
This comment has been minimized.
This comment has been minimized.
|
Using some env vars to define colors sounds like a good idea. :D |
This comment has been minimized.
This comment has been minimized.
|
@retep998 - agreed good defaults are important, which is why we took so long to stabilize and work on what the format should look like. tbh there wasn't a ton of feedback on what it looks like on Windows. The colors are easy enough to change. We could potentially detect Windows and switch to something like: Btw, here's what bright white looks like. I'd be afraid it would blend in too much with the code: |
This comment has been minimized.
This comment has been minimized.
|
@jonathandturner I'm saying to use bright white instead of bold, not instead of blue. If you look at images from other platforms you'll notice how certain text is bold. In conhost that text is not bold because there is no support for bold. Instead of making that text bold, make it bright white on Windows which achieves a similar effect. @GuillaumeGomez Sure, anything is better than the status quo. |
This comment has been minimized.
This comment has been minimized.
|
@retep998 - I think you might have something in mind, though I'm not entirely following what you're saying. All blue text is bold text. I'm certainly amenable to helping here. For example, like I said, we can detect Windows and make changes to the defaults.
I think the best way to help "the status quo" is to help us create a solution that works for Windows. |
This comment has been minimized.
This comment has been minimized.
|
@jonathandturner Look at this screenshot someone posted earlier from a non-windows platform: rust/src/librustc_errors/emitter.rs Line 898 in d00c245 As for a replacement for the "bright" blue currently being used for line numbers and stuff, cyan is the closest alternative there is. Unfortunately bright cyan is being used for help messages, but there's not many choices in the default console color palette that aren't too dark. Also, the color for warnings really needs to be bright yellow on Windows. Dark yellow is just bleh. Specifically this bit of code https://github.com/rust-lang/rust/blob/master/src/librustc_errors/lib.rs#L735 |
jonathandturner
referenced this issue
Aug 31, 2016
Merged
Special case a few colors for Windows #36178
jonathandturner
added a commit
to jonathandturner/rust
that referenced
this issue
Sep 2, 2016
jonathandturner
added a commit
to jonathandturner/rust
that referenced
this issue
Sep 2, 2016
jonathandturner
added a commit
to jonathandturner/rust
that referenced
this issue
Sep 2, 2016
This comment has been minimized.
This comment has been minimized.
|
Re: syntax highlighting, using rustdoc's syntax highlighter after a small refactor (internals discussion): |
This comment has been minimized.
This comment has been minimized.
|
@estebank - I like it |
This comment has been minimized.
This comment has been minimized.
|
@jonathandturner without any customization (just changed the profile in my term): |
This comment has been minimized.
This comment has been minimized.
|
@estebank - yeah, that yellow isn't quite strong enough for white. In the compiler, albeit a bit hacky, we do this:
|
This comment has been minimized.
This comment has been minimized.
|
However you end up doing it, having something that works well on black and white backgrounds might be a good way of picking defaults. |
This comment has been minimized.
This comment has been minimized.
|
Agree. What would you think of using (and avoiding abusing) a set background for specific tokens? |
This comment has been minimized.
This comment has been minimized.
|
@estebank - let's move this discussion to a separate thread because lots of people are following this one. Do you have a PR we can move it to? |
This comment has been minimized.
This comment has been minimized.
|
I'm wondering if it's possible to only use the base colours, instead of the bright versions, especially when there is heavy use of bold at the same time. Most terminals allow an option for setting whether bold text appears in bright colours. Also, some colour schemes (like Solarized) make heavy use of the bright colours for subtle background shades and this may cause the error output to look odd. Of course, full colour customisation is preferable for these types of cases. |
This comment has been minimized.
This comment has been minimized.
|
I feel like this bug has outlived its usefulness. I'm going to close it. |






nikomatsakis commentedApr 27, 2016
•
edited
PR #32756 began a gradual overhaul of our error message formatting. We would very much like feedback on error messages you think could use improvement, as well of course as any bugs or other problems with the new error formatting code. Please leave comments!
What follows is a list of known issues we plan to address. Likely many of these will be moved into distinct GitHub issues at some point.
Improvements to the overall error reporting mechanism:
noteshould not be colored green but rather just appear boldnoteshould not use the-->indicator but rather>>>, and the underline should be--and not^^>>>>for secondary file names to something like:::maybe?Specific error messages that need improvement: