Skip to content
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

Rustfmt/pretty-print types in error messages #2358

Closed
eira-fransham opened this issue Mar 8, 2018 · 2 comments
Closed

Rustfmt/pretty-print types in error messages #2358

eira-fransham opened this issue Mar 8, 2018 · 2 comments

Comments

@eira-fransham
Copy link

For any highly generic library (futures is the one that I hit this issue with a lot) it's easy for types to become unreadable very fast. Even impl Trait only helps so much (we're using Box<Trait> a lot in our code so impl Trait won't get us better error messages). A good solution would be to rustfmt-style pretty-print types in the error messages so that it's possible for humans to parse them. It might be useful to make this optional or otherwise limit the maximum size because I can imagine this causing diesel's types to take hundreds of lines to print. Probably some kind of overrideable heuristic would be useful to implement here.

@olivia-fl
Copy link

This would be very nice. One of the things that I really liked about rust initially was the high quality error messages. I feel like with a lot of these combinator based libraries, the error messages get pretty terrible. I don't think we're at C++ template level yet, but it definitely reminds me of them.

I also think it might be useful to also optionally leave out irrelevant stuff or provide a short summary at the top that is easy to parse for a human in cases in which just pretty-printing things isn't enough.

@Centril
Copy link
Contributor

Centril commented Oct 9, 2018

Closing in favor of rust-lang/rust#54923 as this is a diagnostics issue.

@Centril Centril closed this as completed Oct 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants