-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Better errors #16619
Better errors #16619
Conversation
I tried to keep this in a similar style to what exists, but we don't need to whitelist errors. This will be a long, repetitive list, we should just build everything that's there.
I think at the moment it is too verbose for a default error message, maybe only show it when passing I really like the idea! On the error website we could also link to other resources that might help (IRC etc.). |
cc me |
This is wonderful, and I'd love to help make this more wonderful! Some thoughts:
|
I agree that this makes the error messages too verbose; it's not rare for people on IRC to essentially just ignore what the error message is telling them, because it's just too long (e.g. the "did you mean" suggestions for lifetimes have a long error message, but they include the correct information, but people still just ignore it). I idly wonder if it's worth supporting nested directories for formatting the doc pages, because we could easily accumulate thousands of them, e.g. (This should definitely be possible in future, and possibly overengineering.)
If they were more connected to the diagnostics macros themselves, we could e.g. have |
I think this is because this line is including |
I almost feel like this should be hidden behind a switch (or at least opt-out-able). I use a lot of tools that deal with the output of the compiler (and believe I'm not alone in doing this), and the long lines with links in them would significantly clutter up the flow. Bullish on the principle, but not stoked about the implementation. |
Where does the error description in |
This is exciting! 😃 I love how extensive Rust’s documentation is getting now. I do share the concerns about long error messages, though. Maybe this could be separated into a note-like message, similar to the
which is quite a lot shorter (horizontally) than what we have now, even without this change. The help message would also stand out if it were a different colour, hopefully drawing people’s attention to it. Regarding duplication of explanations, I think this could be handled later. I’d like it if the |
Great idea! Reminds me of angulars error messages, with links to error pages with more details. |
Theres a few things here:
There's tension here: better error output is better for newbies, and more terse output is better for more experienced people or, as @richo mentioned, parsing output. I'm not sure where the right mixture is here. @huonw you're right about the CSS. One thing with not matching up the explain text: it allows for a 'short' and 'long' form explanation. Maybe the right answer is to put the URL at the bottom of each explain text, leave the explain in the register call for now, like it is, and leave the extended explanation as the page.
Is this because of a lack of inodes or something?
It's already embedded inside of the general template, though I'd imagine that eventually, we'd want to change the template around a tiny bit. Unsure. I really like @P1start 's |
@steveklabnik I was thinking something along the lines of |
This can work, but it also means that it can be awkward sometimes. I'm torn. (but you're totally right about code, etc) |
@steveklabnik I'm thinking of the following hierarchy/flow:
|
I'm not sure this is true, but I don't think there's any way to figure it out, really. It'd also be nice if it were 😄 |
(I do like this proposal, though) |
Technically, being brief isn't a huge problem because people often paste weird error messages into Google. Don't know that Verbosity may also be a GUI issue. Visual studio (the older version I used...maybe not the new one) pastes compiler output verbatim. Qt Creator has a second mode which collects the brief descriptions together and only shows the expanded output when you click on the item to expand it. GUIs are probably outside the scope of this bug though. |
Right, this is the big win of giving them pages in the docs, IMHO. |
I think this is easy to figure out. Write a prototype and ask a few rookies to try it out (or post it on Reddit). Ask them which part of the error message they registered (or registered first/best). I'm sure there are a few usability experts at Mozilla. Maybe ask them? |
That's not going to have a large enough sample size to matter. (But yes, a big study would be nice.) |
Still better than nothing? |
I actually don't think so, as it gives you a veil of objectivity without actually being objective. Anyway, it's a distraction, overall. |
Well, of course it won't be objective, that is not really the aim. I thought it might cover more potential rookie-pitfalls than just speculating. |
Digging through how this stuff is set up now. All the diagnostic messages are defined in a single file as raw strings in That doesn't strike me as a particularly scalable solution if each one of these is going to be a huge discussion of the error. However I'm not sure if there's a technical reason for this, or if this was just convenient/reasonable at the time. Not sure why this had to be done as a macro/plugin either. A saner alternative might be to just provide the path to the error md, and have them parsed in as plain text, with the However, with this design librustc and librustdoc don't really need to know about each other, they just both know about these docs. Librustc does gain a minor understanding of markdown (in that it knows #'s at starts of lines are important), and the first section of the docs will have to be fairly more well-formed than other doc pages, but not by much. |
ping @steveklabnik, is this ready to go? |
re-ping @steveklabnik |
This error occurs when it's impossible for a particular `match` arm to ever | ||
match the given pattern, because one of the preceeding arms will match. | ||
|
||
This means that perhaps some of the preceeding patterns are too general, this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/preceeding/preceding/
# Summary | ||
|
||
This error occurs when it's impossible for a particular `match` arm to ever | ||
match the given pattern, because one of the preceeding arms will match. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/preceeding/preceding/
@aturon it's unclear to me that there's any kind of consensus about what the output should be, with and without the flag. If we can make that decision, I'll happily get this ready to merge. |
This adds ‘help’ diagnostic messages to rustc. This is used for anything that provides help to the user, particularly the `--explain` messages that were previously integrated into the relevant error message. They look like this: ``` match.rs:10:13: 10:14 error: unreachable pattern [E0001] match.rs:10 1 => {}, ^ match.rs:3:1: 3:38 note: in expansion of foo! match.rs:7:5: 20:2 note: expansion site match.rs:10:13: 10:14 help: pass `--explain E0001` to see a detailed explanation ``` (`help` is coloured cyan.) Adding these errors on a separate line stops the lines from being too long, as discussed in #16619.
@steveklabnik I think there was some consensus that the message is currently too long. I would be fine with moving the link to the
|
💃 just want to show my general delight to see motion on this |
Closing due to inactivity (and @bors's queue is quite full!) Feel free to reopen with a rebase! |
This is the start of my attempt to address #2092.
What this is
Right now, when you compile with an error, you get this:
Note the
[E0001]
error code and the ability to get an explanation.This is sweet! But we can do better.
What this adds
With this PR applied, you get this instead:
Along with the doc machinery to generate that page. This should give us a place to provide even more help around errors, and guide people through problems. If they don't have an internet connection, they can see the pages locally as well.
This PR isn't really 'ready' yet, but I wanted to get some feedback. The error pages don't display CSS correctly, and I think I screwed up my git-fu to fix that error message, but I'm about to jump on a plane. Please let me know what you think, and I'll keep working on this if it's a path we want to go down.