Uh oh!
There was an error while loading. Please reload this page.
Conversation
(and, some style changes to how the messages are displayed)
rust-highfive
commented
Nov 22, 2015
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @pnkfelix (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
ghost
commented
Nov 22, 2015
@Manishearth A lot of things need to be clarified! Feel free to burn it down :) |
There was a problem hiding this comment.
The space is added only to separate the span from the file name (for visibility).
The colon has been replaced with an arrow, because we already use it to separate the line number from the character number.
There was a problem hiding this comment.
I think the first space shouldn't be there. Many editors let you say open foo.rs:1:2 on the command line and will open focused on that line. It's easier to copy-paste if there is no space.
There was a problem hiding this comment.
I would not use -> since we use it for function types/signatures. I'd use to or ... or keep the :
ghost
commented
Nov 22, 2015
Now, a single-line error message looks like, (yeah, it's funny) ... and a multi-line warning looks like, Thoughts? |
ghost
commented
Nov 22, 2015
Oh no. Look at the travis log! |
Manishearth
commented
Nov 23, 2015
That's compiletest not being able to handle the new formatting. We can either add a flag to preserve the old formatting (which we need to do anyway, simple fix) and have compiletest use that, or we can fix up compiletest to handle the new formatting. |
Manishearth
commented
Nov 23, 2015
bikeshed:
|
nrc
commented
Nov 23, 2015
@Manishearth not sure how this relates to @Wafflespeanut's example above, so I may be misunderstanding, but...
What does an error message with a macro expansion trace look like? |
Manishearth
commented
Nov 23, 2015
The reason I think it should be indented is to visually separate code from error. We already do that with colors, but I think this would be clearer -- easier to see errors when scanning the log |
nrc
commented
Nov 23, 2015
If the error is indented, then being not indented would give visual separation (in theory, you'd have to have a big example to check). |
ghost
commented
Nov 23, 2015
@nrc Here's macro expansion |
ghost
commented
Nov 23, 2015
Um, we only have a few lines of code. Others are replaced with the ellipsis anyway, right?
The first line in any compiler message shows the entire span where something bad has occurred. Only the other few lines don't have the line numbers. Should we really need the line numbers for all the lines? |
evincarofautumn
commented
Nov 23, 2015
For what it’s worth, there is a GNU standard for source locations in diagnostic messages, which some tools (Emacs?) support out of the box for jumping to and highlighting locations: It extends easily: Also, re. relative vs. absolute paths, errors could follow the behaviour of Make’s |
bstrie
commented
Nov 24, 2015
Tagging with T-Tools as I figure it's worth having the Tools team meet to discuss this. |
bstrie
commented
Nov 24, 2015
Personally I feel like rather than have a switch for "legacy error message mode", we should just move forward with nicely-formatted and deliberately-unstable human-readable error messages, with an optional switch to produce machine-readable error messages. That way we can support tools nicely (nicer than the current error messages) while also allowing us to evolve the typical error messages without feeling like everything has to be perfect immediately. For example, I like Elm's use of color in error message to direct the reader's eye (https://www.reddit.com/r/rust/comments/3ti20g/not_rust_specific_compilers_as_assistants_elm_016/), but that's not something that we need to bikeshed immediately. For now just removing the redundant filename to fix #3533 would be a win on its own. |
brendanzab
commented
Nov 24, 2015
@evincarofautumn: GNU paths are very handy. One of the small things that annoys me about Elm's errors is the lack of those paths. They don't need to be repeated constantly like rustc currently does, but it would be a shame to lose them in the interests of going too far towards hiding complexity. I guess with machine-readable errors in the future, it might become easier to make 'beginner' and 'advanced' front-ends for error formatting (that may not be desirable though). |
brendanzab
commented
Nov 24, 2015
Ugh - your right @bstrie, this is not really the place for bikeshedding this stuff. Sorry! |
bstrie
commented
Nov 25, 2015
@Wafflespeanut, I tend to agree with those advocating the GNU style for formatting the file/line/column readout, if only because it's a widely-used precedent and we could spend forever bikeshedding alternatives. For now I think it's still a huge win to just remove the redundant info on every single line and at last put #3533 to bed. |
frewsxcv
commented
Nov 27, 2015
👍 for anything that makes the messages consume less horizontal space |
brson
commented
Dec 2, 2015
I'd like to see an example of serious spew after this change. It's hard to judge the true effect of this from tiny snippets. Adding another line to every error with a span will decrease the overall number of errors per screen. |
brson
commented
Dec 2, 2015
I think this is more a @rust-lang/compiler bug than @rust-lang/tools |
arielb1
commented
Dec 2, 2015
The error message already splits to multiple lines because the pathname is so long. |
brendanzab
commented
Dec 2, 2015
Yeah, the addition of new lines, whilst a valid concern, is offset by the fact that many of us have to make our terminals super wide to accommodate the long paths. |
pnkfelix
commented
Dec 11, 2015
triage: I-nominated Nominating for discussion at compiler team meeting. (Basically, even if I reviewed this patch and were 100% happy with its effects, I would not feel comfortable introducing these changes without first discussing with the rest of the compiler team.) |
ghost
commented
Dec 11, 2015
@pnkfelix Agreed. Also, (for reference), there were a lot of suggestions at /r/rust. |
nrc
commented
Dec 17, 2015
@Wafflespeanut could you provide an example with lots of errors please? (as requested by @brson above). |
nikomatsakis
commented
Dec 17, 2015
I definitely think we should try to follow a standard of some kind for indicating the file/line-number etc :) I was under the impression that we already did, or at least I've seen similar formatting from a number of tools and emacs seems to recognize it "out of the box". I also think we should not be afraid to change the precise formatting of our messages. I consider it unstable and targeting humans, not tools. But I guess no reason to change willy nilly either. |
pnkfelix
commented
Dec 17, 2015
@Wafflespeanut just so this does not get lost in the shuffle: we need a legacy output flag; it was previously described as "a flag to preserve the old formatting", but it might be easier to think of as an output format that is:
|
Manishearth
commented
Dec 18, 2015
Yeah, the standard is
Agreed. Though for tools in the long run I think we should provide structured (JSON) output or something. /me idly proposes "spanhandler plugins" |
bors
commented
Dec 18, 2015
☔ The latest upstream changes (presumably #30457) made this pull request unmergeable. Please resolve the merge conflicts. |
nikomatsakis
commented
Dec 18, 2015
Well, there are probably many fixed standards. The one that was cited earlier by @evincarofautumn is this GNU page, which proposes: Interestingly, we don't seem to do any of those today, and yet emacs correctly highlights regions for me, so it must understand some superset of those formats. Also, that web page is a bit weird, since it seems to indicate that |
ghost
commented
Dec 20, 2015
@brson@nrc "spew of errors" ... (Note that there are some off-by-one errors while displaying the span, which can be fixed. Also, this applies only to errors - I haven't added newline to the help & note) And, I agree that we need the legacy output flag. I'll update this soon :) |
eddyb
commented
Dec 20, 2015
@Wafflespeanut AFAICT this just breaks error listing completely in at least the editors I use. Already type errors are almost useless since the actual type mismatch isn't part of the error message. Maybe the "nicer" multi-line output forms should be restricted to terminal stdout? |
Manishearth
commented
Dec 20, 2015
Most editors can be fed a per-language regex for how to decode more complex data from error messages. |
eddyb
commented
Dec 20, 2015
@Manishearth how many of those work with multiple lines per error message? |
Manishearth
commented
Dec 20, 2015
No idea. I don't use shortform error listings much. I think here you should just configure your editor to use the legacy output. Editor-friendly output is more often than not human-unfriendly; and one of the core issues this PR was trying to address was that having everything on one line is incredibly ugly and hard for humans to read on split terminals. We should still ensure that things like jump-to-line on a full error listing work on the new system, though. (Since that's easy to get right without impacting readability) |
brson
commented
Dec 22, 2015
ISTR that I implemented the range output, and specifically did not follow the standards because the thing that we currently implement worked correctly with emacs whereas others I tried did not. |
nikomatsakis
commented
Jan 7, 2016
I think I am r+ on the intention here but r- on the specific details of this PR. I think we should evolve it more before we land. What I think I would really like to see (some of which is in this PR):
That said, I find the exact output here to have some shortcomings and be not quite ready to land. For example, it seems somewhat inconsistent to have error messages begin on a new line and TL;DR we should iterate on this more, but it's going in a good direction -- and we should take care to ensure that editors continue to work well. :) |
nrc
commented
Jan 7, 2016
We discussed this at the compiler meeting, conclusions:
|
ghost
commented
Jan 8, 2016
Awesome! Thanks :) |
fixes#3533