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
There was a problem hiding this comment.
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.
@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.
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. |
src/libsyntax/test_snippet.rs
Outdated
There was a problem hiding this comment.
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: