-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Position span label correctly when it isn't last #42616
Conversation
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
src/test/ui/span/issue-42595.stderr
Outdated
15 | map.entry("e").or_insert(0) += 1; | ||
| ---------------------------^^^^^ | ||
| | | ||
| cannot use `+=` on type `&mut {integer}` |
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.
I'm a little confused as to the intent of this message. Is it trying to just point at the +=
(which seems correct)? If so, the underline-like arrow beneath the rest of the line looks really odd to me. Might just not be used to it though.. nor do I have any ideas as to what else we could do.
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.
@Mark-Simulacrum, the primary span which doesn't have a label is as follows:
15 | map.entry("e").or_insert(0) += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
My assumption is that there should be only one span in this error, either:
15 | map.entry("e").or_insert(0) += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot use `+=` on type `&mut {integer}`
or
15 | map.entry("e").or_insert(0) += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot use `+=` on type `&mut {integer}`
Once we fix that, I'll have to find a new way to have a test for this bug, though.
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.
Oh. I would have expected the span to be on +=
, actually, not the whole expression or some part of it. Obviously that's a separate discussion though -- no need to fix here.
0984fa0
to
3171248
Compare
Argh why do I keep getting picked on these PRs. r? @jonathandturner |
This is a Niko one, I think he did the drawing layout bit. |
--> test.rs:3:3 | ||
| | ||
3 | a bc d | ||
| ^^^^---- |
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.
it's progress for sure. I still find these sorts of overlap scenarios pretty mind boggling regardless, though i'm not sure how best to fix in general. I'd sort of like to separate the ^^^
and ---
on different lines. i.e., if I was highlighting this by hand I would probably do:
a bc d
^^^^
----
but anyway.
I thought that "expected output" looked wrong...
r=me once this is fixed |
802659c
to
1494d10
Compare
@bors r+ |
📌 Commit 8074a88 has been approved by |
@bors rollup |
Position span label correctly when it isn't last Fix rust-lang#42595. Before: ``` 15 | map.entry("e").or_insert(0) += 1; | ---------------------------^^^^^ot use `+=` on type `&mut {integer}` ``` After: ``` 15 | map.entry("e").or_insert(0) += 1; | ---------------------------^^^^^ | | | cannot use `+=` on type `&mut {integer}` ```
Fix #42595.
Before:
After: