about summary refs log tree commit diff
path: root/compiler/rustc_parse
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-08-15 20:11:35 +0200
committerGitHub <noreply@github.com>2022-08-15 20:11:35 +0200
commite369ec871e7194ea3f97704651f08edd974c1135 (patch)
treeb1f1a4379634ecd230655296809e9038cf9350b7 /compiler/rustc_parse
parent3aa5734a2cf8d401ec7d194c87978f4a1231bb9d (diff)
parent9b0edd099dfe01b7e69140562cca3fe72ed445e9 (diff)
downloadrust-e369ec871e7194ea3f97704651f08edd974c1135.tar.gz
rust-e369ec871e7194ea3f97704651f08edd974c1135.zip
Rollup merge of #100458 - compiler-errors:fn-argument-span, r=estebank
Adjust span of fn argument declaration

Span of a fn argument declaration goes from:

```
fn foo(i : i32 , ...)
       ^^^^^^^^
```

to:

```
fn foo(i : i32 , ...)
       ^^^^^^^
```

That is, we don't include the extra spacing up to the trailing comma, which I think is more correct.

cc https://github.com/rust-lang/rust/pull/99646#discussion_r944568074
r? ``@estebank``

---

The two tests that had dramatic changes in their rendering I think actually are improved, though they are kinda poor spans both before and after the changes. :shrug: Thoughts?
Diffstat (limited to 'compiler/rustc_parse')
-rw-r--r--compiler/rustc_parse/src/parser/item.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs
index 81d0e4733d0..f3f070e6eb0 100644
--- a/compiler/rustc_parse/src/parser/item.rs
+++ b/compiler/rustc_parse/src/parser/item.rs
@@ -2338,7 +2338,7 @@ impl<'a> Parser<'a> {
                 }
             };
 
-            let span = lo.until(this.token.span);
+            let span = lo.to(this.prev_token.span);
 
             Ok((
                 Param {