rust/compiler/rustc_lint/src
Matthias Krüger ed58c01959 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
2023-02-04 13:36:14 +01:00
..
nonstandard_style mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
array_into_iter.rs refactor: cleanup 2023-01-09 18:57:02 -05:00
builtin.rs Review changes 2023-01-31 07:54:01 +00:00
context.rs Allow more deriving on packed structs. 2023-01-30 12:00:42 +11:00
deref_into_dyn_supertrait.rs migrate: deref_into_dyn_supertrait.rs 2023-01-09 18:57:02 -05:00
early.rs fix issues in unused lint 2023-01-14 17:11:04 +08:00
enum_intrinsics_non_enums.rs refactor: cleanup 2023-01-09 18:57:02 -05:00
errors.rs refactor: cleanup 2023-01-09 18:57:02 -05:00
expect.rs Auto merge of #106776 - oli-obk:om_nom_nom_nom_nom, r=cjgillot 2023-01-13 13:57:21 +00:00
for_loops_over_fallibles.rs fix: use LocalDefId instead of HirId in trait res 2023-01-23 11:42:18 +00:00
hidden_unicode_codepoints.rs migrate: hidden_unicode_codepoints.rs 2023-01-09 17:07:25 -05:00
internal.rs remove redundant clones 2023-01-15 15:02:02 +01:00
late.rs Remove HirId -> LocalDefId map from HIR. 2023-01-28 09:55:26 +00:00
let_underscore.rs refactor: cleanup 2023-01-09 18:57:02 -05:00
levels.rs Remove double spaces after dots in comments 2023-01-17 08:09:33 +00:00
lib.rs make unaligned_reference a hard error 2023-01-31 20:28:11 +01:00
lints.rs Reintroduce multiple_supertrait_upcastable lint 2023-01-28 15:08:07 +00:00
methods.rs refactor: cleanup 2023-01-09 18:57:02 -05:00
multiple_supertrait_upcastable.rs Reintroduce multiple_supertrait_upcastable lint 2023-01-28 15:08:07 +00:00
non_ascii_idents.rs refactor: cleanup 2023-01-09 18:57:02 -05:00
non_fmt_panic.rs refactor: cleanup 2023-01-09 18:57:02 -05:00
nonstandard_style.rs Remove HirId -> LocalDefId map from HIR. 2023-01-28 09:55:26 +00:00
noop_method_call.rs refactor: cleanup 2023-01-09 18:57:02 -05:00
opaque_hidden_inferred_bound.rs Ensure no one constructs AliasTys themselves 2022-12-14 15:36:39 +00:00
pass_by_value.rs remove redundant clones 2023-01-15 15:02:02 +01:00
passes.rs Take a LocalDefId in hir::Visitor::visit_fn. 2023-01-28 09:51:50 +00:00
redundant_semicolon.rs refactor: cleanup 2023-01-09 18:57:02 -05:00
tests.rs Update to last upstream version 2021-07-08 17:14:28 +02:00
traits.rs refactor: cleanup 2023-01-09 18:57:02 -05:00
types.rs Remove HirId -> LocalDefId map from HIR. 2023-01-28 09:55:26 +00:00
unused.rs don't point at nonexisting code beyond EOF when warning about unused delims 2023-02-04 13:36:14 +01:00