-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Show more of the overlong type on type-length error #76777
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
I don't run into these errors often, but I would rather have the short version of the error for both of the cases in the test suite. Brevity can also be helpful for debugging. Presumably 256 was chosen because it gives good results for the case in #76785? It seems that the problem there is more about where the break occurs. What about tracking delimiters ( @eddyb wants to remove this class of errors entirely. Maybe they have a stronger opinion than I do? |
Test files are autogenerated by the "bless" command, so I don't think I can trim them. I know it looks messy, but it is an inherently messy error. If it doesn't show the long ugly type, then it's not known what the ugly type is about. I can't think of a simple heuristic to display only "interesting" part of a type. It's not as easy as skipping punctuation, since opaque types are also noise and have non-trivial syntax. Trying to pretty-print a 350MB-long type would be difficult, and might end up with something silly like a million spaces of indentation. |
Oh, I have an idea! rustc could write the full multi-megabyte type name to a temp file on disk, and the error message can print the file name. Implemented in #76843 |
…c-morse Let user see the full type of type-length limit error Seeing the full type of the error is sometimes essential to diagnosing the problem, but the type itself is too long to be displayed in the terminal in a useful fashion. This change solves this dilemma by writing the full offending type name to a file, and displays this filename as a note. > note: the full type name been written to '$TEST_BUILD_DIR/issues/issue-22638/issue-22638.long-type.txt' Closes rust-lang#76777
…morse Let user see the full type of type-length limit error Seeing the full type of the error is sometimes essential to diagnosing the problem, but the type itself is too long to be displayed in the terminal in a useful fashion. This change solves this dilemma by writing the full offending type name to a file, and displays this filename as a note. > note: the full type name been written to '$TEST_BUILD_DIR/issues/issue-22638/issue-22638.long-type.txt' Closes rust-lang#76777
The long type-length error trims the type too much, and makes it very hard to identify where the offending type comes from (like in #76785).
Longer type length won't be pretty in terminals, but may help diagnosing the problem.