Skip to content

Commit 3becbbc

Browse files
committed
Fixed off-by-one span.
Fixes the off-by-one span issue where closure argument spans were pointing to the token after the argument.
1 parent 97bbcab commit 3becbbc

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/libsyntax/parse/parser.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1848,7 +1848,7 @@ impl<'a> Parser<'a> {
18481848
P(Ty {
18491849
id: ast::DUMMY_NODE_ID,
18501850
node: TyKind::Infer,
1851-
span: self.span,
1851+
span: self.prev_span,
18521852
})
18531853
};
18541854
Ok(Arg {

src/test/ui/nll/issue-52534.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ error[E0597]: `x` does not live long enough
22
--> $DIR/issue-52534.rs:22:14
33
|
44
LL | foo(|a| &x)
5-
| - ^ `x` would have to be valid for `'0`
6-
| |
7-
| has type `&'0 u32`
5+
| - ^ `x` would have to be valid for `'0`
6+
| |
7+
| has type `&'0 u32`
88
LL | }
99
| - ...but `x` is only valid for the duration of the `bar` function, so it is dropped here while still borrowed
1010

1111
error[E0597]: `y` does not live long enough
1212
--> $DIR/issue-52534.rs:27:26
1313
|
1414
LL | baz(|first, second| &y)
15-
| - ^ `y` would have to be valid for `'0`
16-
| |
17-
| has type `&'0 u32`
15+
| ----- ^ `y` would have to be valid for `'0`
16+
| |
17+
| has type `&'0 u32`
1818
LL | }
1919
| - ...but `y` is only valid for the duration of the `foobar` function, so it is dropped here while still borrowed
2020

src/test/ui/regions/regions-nested-fns-2.nll.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0597]: `y` does not live long enough
22
--> $DIR/regions-nested-fns-2.rs:18:25
33
|
44
LL | |z| {
5-
| - has type `&'0 isize`
5+
| - has type `&'0 isize`
66
LL | //~^ ERROR E0373
77
LL | if false { &y } else { z }
88
| ^ `y` would have to be valid for `'0`

src/test/ui/regions/regions-nested-fns.nll.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ error[E0597]: `y` does not live long enough
2525
--> $DIR/regions-nested-fns.rs:19:15
2626
|
2727
LL | ignore::<Box<for<'z> FnMut(&'z isize)>>(Box::new(|z| {
28-
| - has type `&'0 isize`
28+
| - has type `&'0 isize`
2929
LL | ay = x;
3030
LL | ay = &y;
3131
| ^ `y` would have to be valid for `'0`

0 commit comments

Comments
 (0)