about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-02-04 13:27:53 +0100
committerMatthias Krüger <matthias.krueger@famsik.de>2023-02-04 13:36:14 +0100
commited58c01959bc69b42943292d7d5a8e86a821747e (patch)
tree2e4561ba7cbd8ddeea70ea958144c695acdbf313 /compiler/rustc_codegen_llvm/src
parent9545094994f1ab45cab5799d5b45980871a9e97b (diff)
downloadrust-ed58c01959bc69b42943292d7d5a8e86a821747e.tar.gz
rust-ed58c01959bc69b42943292d7d5a8e86a821747e.zip
don't point at nonexisting code beyond EOF when warning about unused delims
Previously we would show this:
```
warning: unnecessary braces around block return value
 --> /tmp/bad.rs:1:8
  |
1 | fn a(){{{
  |        ^  ^
  |
  = note: `#[warn(unused_braces)]` on by default
help: remove these braces
  |
1 - fn a(){{{
1 + fn a(){{
  |
```

which is now hidden in this case.
We would create a span spanning between the pair of redundant {}s but there is only EOF instead of the `}` so we would previously point at nothing.
This would cause the debug assertion ice to trigger.
I would have loved to just only point at the second delim and say "you can remove that" but I'm not sure how to do that without refactoring the entire diagnostic which seems tricky. :(
But given that this does not seem to regress any other tests we have, I think this edge-casey enough be acceptable.

Fixes https://github.com/rust-lang/rust/issues/107423

r? @compiler-errors
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions