-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
E0433 needs to be updated to new format #35345
Comments
Not so sure about how the bonus part can be implemented. Here:
The type/module name (if you don't want to parse it from A solution would be to make
would become
Problem now is this part of
here the finished message is not a simple concatenation of "unresolved [...]" + <name of the module/type> Any tips? |
Yeah, this one looks like it might take some significant changes. When I wrote the bonuses, I wasn't sure which ones would be doable with the information local to the error. Pinging @arielb1 and @nikomatsakis, who know this area better than I do and who might be able say for sure if this is doable. |
Actually @jseyfried knows this area of the code best -- it does seem like you'd have to tweak things a bit to get the tighter span. |
I've been looking around The span is generated in
Since we want to point to the segment of the path that couldn't be resolved, we could go into
So when a segment of the path generates an error you can get the span of that segment and hand it back up the stack in the error type (which carries the span of the whole path at the moment) where So basically the span in
Would be the span belonging to the Now we only need two different strings in there (one for the error message and one for the label). and we're done. Is this something that could work? |
…athandturner Updated E0433 to new error message. (no bonus) Part of rust-lang#35345 r? @jonathandturner
…athandturner Updated E0433 to new error message. (no bonus) Part of rust-lang#35345 r? @jonathandturner
…athandturner Updated E0433 to new error message. (no bonus) Part of rust-lang#35345 r? @jonathandturner
@hank-der-hafenarbeiter Yeah, I believe that would work. The only downside I can think of is the increase in memory usage from the extra |
@jseyfried the span of a path is the combined path of it's path segments, aren't they? So if the span for the whole path is needed we can get that from combining the segment's spans. I don't know enough about how spans are generated and how much memory this would cost but considering that most of the time a span to the segment will be more helpful anyway this might very well be worth it. If I can assist in any way I'd love to. Just let me know! |
Closing this issue, but feel free to open a new issue for the bonus |
From: src/test/compile-fail/derived-errors/issue-31997-1.rs
Error E0433 needs a span_label, updating it from:
To:
Bonus, focus the span on just the part that is causing the issue:
The text was updated successfully, but these errors were encountered: