about summary refs log tree commit diff
path: root/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.diff
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-10-16 02:09:58 +0200
committerGitHub <noreply@github.com>2020-10-16 02:09:58 +0200
commit075f2bfc393c0c4efc8d18d839c0d91c496dbaba (patch)
treede8d7d0c0ff12019f9fcb4a2a729d5384de069cb /tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.diff
parentdd7fc54ebdca419ad9d3ab1e9f5ed14e770768ea (diff)
parent14b2d16c5c014de994c46eb17e52773ee01864c5 (diff)
downloadrust-075f2bfc393c0c4efc8d18d839c0d91c496dbaba.tar.gz
rust-075f2bfc393c0c4efc8d18d839c0d91c496dbaba.zip
Rollup merge of #75023 - euclio:argument-span, r=estebank
ensure arguments are included in count mismatch span

The current diagnostic isn't very helpful if the function header spans multiple lines. Lines comprising the function signature may be elided to keep the diagnostic short, but these lines are essential to fixing the error. This is made worse when the function has a body, because the last two lines of the span are then dedicated to showing the end of the body, which is irrelevant.

This PR changes the span to be a multispan made up of the header and the the arguments, ensuring they won't be elided. It also discards the function body from the span.

[Old](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=f92d9f81a8c9416f0f04e4e09923b6d4):

```
error[E0061]: this function takes 6 arguments but 1 argument was supplied
  --> src/main.rs:18:5
   |
1  | / fn bar(
2  | |     a: i32,
3  | |     b: i32,
4  | |     c: i32,
...  |
14 | |     println!("{}", f);
15 | | }
   | |_- defined here
...
18 |       bar(1);
   |       ^^^ - supplied 1 argument
   |       |
   |       expected 6 arguments
```

New:

```
error[E0061]: this function takes 6 arguments but 1 argument was supplied
  --> $DIR/not-enough-arguments.rs:28:3
   |
LL |   bar(1);
   |   ^^^ - supplied 1 argument
   |   |
   |   expected 6 arguments
   |
note: function defined here
  --> $DIR/not-enough-arguments.rs:9:1
   |
LL | / fn bar(
LL | |     a: i32,
   | |     ^^^^^^^
LL | |     b: i32,
   | |     ^^^^^^^
LL | |     c: i32,
   | |     ^^^^^^^
LL | |     d: i32,
   | |     ^^^^^^^
LL | |     e: i32,
   | |     ^^^^^^^
LL | |     f: i32,
   | |     ^^^^^^^
LL | | ) {
   | |_^
```
Diffstat (limited to 'tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.diff')
0 files changed, 0 insertions, 0 deletions