-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Reduce visual clutter of multiline start when possible #41245
Conversation
Seems better. I would still like to make progress on only highlighting the struct name etc, though I know that's a deeper edit. |
I wonder if the |
#41214 is an attempt at doing the smallest patch possible that would accomplish that.
Would it make sense to remove the |
e06dacf
to
a651d5e
Compare
@nikomatsakis - seconded on "can we underline just the name". I feel like often, but not always, that's what we want to do. |
4586517
to
f52e1df
Compare
I've wondered the same. I think quite likely yes. |
f52e1df
to
2d119ff
Compare
Looks like tests need to be fixed here. |
2d119ff
to
db3c5ff
Compare
@estebank I like it. One thing I've also wondered: would it be hard to put the label text at the top rather than the bottom? I usually find that a bit more intuitive. |
db3c5ff
to
b3458c9
Compare
@nikomatsakis it wouldn't be hard to do it, but I've been thinking about doing the following 2 | fn foo() { {
| ____^ -
| | ___________|
| ||
3 | ||
4 | || } }
| ||__- ^
| |_____| instead of 2 | fn foo() { {
| ___^_______-
| |___|
| ||
3 | ||
4 | || } }
| || - ^
| ||__|_|
| |__| which wouldn't work with labels (regardless of on top or the bottom). (Then again, it doesn't work with them in the bottom with that change either.) I'll add the change to do move the labels on the top to this PR. |
e096cfa
to
cbbe6a6
Compare
Also just realized, while moving the labels to the beginning, this PR's change is unworkable, as the you need the line for the label after the first line of the span to be able to show the text. Keeping it in the end, either always or only when the multiline span is the only thing being shown, would be necessary to decrease the vertical space waste. |
44f36f0
to
b6da758
Compare
Oh, hmm, good point! You could preserve the total number of lines like so:
But I imagine that part of the point here is also just not to interject stuff into the middle. |
@estebank ok well let's leave labels at the end for now. PR seems good to me. Did you plan to make more changes? |
@nikomatsakis I just need to clean up the last commit. Shall we merge this with the removal of the |
b6da758
to
ff72621
Compare
👍 from me |
6639fd0
to
152a74c
Compare
👍 |
@nikomatsakis, I'll r=you once I've fixed the current output discrepancy: [00:58:15] expected output:
[00:58:15] ------
[00:58:15] error: foo
[00:58:15] --> test.rs:3:3
[00:58:15] |
[00:58:15] 3 | X0 Y0
[00:58:15] | ____^__-
[00:58:15] | | ___|
[00:58:15] 4 | || Y1 X1
[00:58:15] | ||____-__^ `X` is a good letter
[00:58:15] | |_____|
[00:58:15] | `Y` is a good letter too
[00:58:15]
[00:58:15] ------
[00:58:15] actual output:
[00:58:15] ------
[00:58:15] error: foo
[00:58:15] --> test.rs:3:3
[00:58:15] |
[00:58:15] 3 | X0 Y0
[00:58:15] | ____^__-
[00:58:15] 4 | || Y1 X1
[00:58:15] | ||____-__^ `X` is a good letter
[00:58:15] | |_____|
[00:58:15] | `Y` is a good letter too Is there a way to run only these tests using Also, I'll have to rebase to fix tests that have changed since I created this PR. |
8f5afc7
to
0ca2234
Compare
@estebank what test is it? A useful option is
will put you into a shell with all the environment and stuff setup. It'll print the last command (which failed). So you can copy-and-paste that command and then re-run to your heart's content. |
@nikomatsakis it's |
4c79c51
to
b13eb7c
Compare
When a span starts on a line with nothing but whitespace to the left, and there are no other annotations in that line, simplify the visual representation of the span. Go from: ```rust error[E0072]: recursive type `A` has infinite size --> file2.rs:1:1 | 1 | struct A { | _^ starting here... 2 | | a: A, 3 | | } | |_^ ...ending here: recursive type has infinite size | ``` To: ```rust error[E0072]: recursive type `A` has infinite size --> file2.rs:1:1 | 1 | / struct A { 2 | | a: A, 3 | | } | |_^ recursive type has infinite size ``` Remove `starting here...`/`...ending here` labels from all multiline diagnostics.
b13eb7c
to
cc07c35
Compare
@bors r=nikomatsakis |
📌 Commit cc07c35 has been approved by |
Reduce visual clutter of multiline start when possible When a span starts on a line with nothing but whitespace to the left, and there are no other annotations in that line, simplify the visual representation of the span. Go from: ```rust error[E0072]: recursive type `A` has infinite size --> file2.rs:1:1 | 1 | struct A { | _^ starting here... 2 | | a: A, 3 | | } | |_^ ...ending here: recursive type has infinite size | ``` To: ```rust error[E0072]: recursive type `A` has infinite size --> file2.rs:1:1 | 1 | / struct A { 2 | | a: A, 3 | | } | |_^ recursive type has infinite size ``` Re: #38246. r? @nikomatsakis CC @jonathandturner
☀️ Test successful - status-appveyor, status-travis |
When a span starts on a line with nothing but whitespace to the left,
and there are no other annotations in that line, simplify the visual
representation of the span.
Go from:
To:
Re: #38246.
r? @nikomatsakis CC @jonathandturner