Skip to content

Commit 95daa06

Browse files
committed
fix off-by-one in parameter spans
1 parent 7f58716 commit 95daa06

File tree

4 files changed

+37
-37
lines changed

4 files changed

+37
-37
lines changed

compiler/rustc_parse/src/parser/item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1744,7 +1744,7 @@ impl<'a> Parser<'a> {
17441744
}
17451745
};
17461746

1747-
let span = lo.to(self.token.span);
1747+
let span = lo.until(self.token.span);
17481748

17491749
Ok(Param {
17501750
attrs: attrs.into(),

src/test/ui/c-variadic/variadic-ffi-no-fixed-args.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: C-variadic function must be declared with at least one named argument
22
--> $DIR/variadic-ffi-no-fixed-args.rs:2:12
33
|
44
LL | fn foo(...);
5-
| ^^^^
5+
| ^^^
66

77
error: aborting due to previous error
88

src/test/ui/mismatched_types/issue-38371.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
22
--> $DIR/issue-38371.rs:4:8
33
|
44
LL | fn foo(&foo: Foo) {
5-
| ^^^^------
5+
| ^^^^-----
66
| | |
77
| | expected due to this
88
| expected struct `Foo`, found reference

src/test/ui/parser/variadic-ffi-semantic-restrictions.stderr

+34-34
Original file line numberDiff line numberDiff line change
@@ -2,205 +2,205 @@ error: only foreign or `unsafe extern "C" functions may be C-variadic
22
--> $DIR/variadic-ffi-semantic-restrictions.rs:5:19
33
|
44
LL | fn f1_1(x: isize, ...) {}
5-
| ^^^^
5+
| ^^^
66

77
error: C-variadic function must be declared with at least one named argument
88
--> $DIR/variadic-ffi-semantic-restrictions.rs:8:9
99
|
1010
LL | fn f1_2(...) {}
11-
| ^^^^
11+
| ^^^
1212

1313
error: only foreign or `unsafe extern "C" functions may be C-variadic
1414
--> $DIR/variadic-ffi-semantic-restrictions.rs:8:9
1515
|
1616
LL | fn f1_2(...) {}
17-
| ^^^^
17+
| ^^^
1818

1919
error: only foreign or `unsafe extern "C" functions may be C-variadic
2020
--> $DIR/variadic-ffi-semantic-restrictions.rs:12:30
2121
|
2222
LL | extern "C" fn f2_1(x: isize, ...) {}
23-
| ^^^^
23+
| ^^^
2424

2525
error: C-variadic function must be declared with at least one named argument
2626
--> $DIR/variadic-ffi-semantic-restrictions.rs:15:20
2727
|
2828
LL | extern "C" fn f2_2(...) {}
29-
| ^^^^
29+
| ^^^
3030

3131
error: only foreign or `unsafe extern "C" functions may be C-variadic
3232
--> $DIR/variadic-ffi-semantic-restrictions.rs:15:20
3333
|
3434
LL | extern "C" fn f2_2(...) {}
35-
| ^^^^
35+
| ^^^
3636

3737
error: `...` must be the last argument of a C-variadic function
3838
--> $DIR/variadic-ffi-semantic-restrictions.rs:19:20
3939
|
4040
LL | extern "C" fn f2_3(..., x: isize) {}
41-
| ^^^^
41+
| ^^^
4242

4343
error: only foreign or `unsafe extern "C" functions may be C-variadic
4444
--> $DIR/variadic-ffi-semantic-restrictions.rs:19:20
4545
|
4646
LL | extern "C" fn f2_3(..., x: isize) {}
47-
| ^^^^
47+
| ^^^
4848

4949
error: only foreign or `unsafe extern "C" functions may be C-variadic
5050
--> $DIR/variadic-ffi-semantic-restrictions.rs:23:26
5151
|
5252
LL | extern fn f3_1(x: isize, ...) {}
53-
| ^^^^
53+
| ^^^
5454

5555
error: C-variadic function must be declared with at least one named argument
5656
--> $DIR/variadic-ffi-semantic-restrictions.rs:26:16
5757
|
5858
LL | extern fn f3_2(...) {}
59-
| ^^^^
59+
| ^^^
6060

6161
error: only foreign or `unsafe extern "C" functions may be C-variadic
6262
--> $DIR/variadic-ffi-semantic-restrictions.rs:26:16
6363
|
6464
LL | extern fn f3_2(...) {}
65-
| ^^^^
65+
| ^^^
6666

6767
error: `...` must be the last argument of a C-variadic function
6868
--> $DIR/variadic-ffi-semantic-restrictions.rs:30:16
6969
|
7070
LL | extern fn f3_3(..., x: isize) {}
71-
| ^^^^
71+
| ^^^
7272

7373
error: only foreign or `unsafe extern "C" functions may be C-variadic
7474
--> $DIR/variadic-ffi-semantic-restrictions.rs:30:16
7575
|
7676
LL | extern fn f3_3(..., x: isize) {}
77-
| ^^^^
77+
| ^^^
7878

7979
error: C-variadic function must be declared with at least one named argument
8080
--> $DIR/variadic-ffi-semantic-restrictions.rs:35:13
8181
|
8282
LL | fn e_f1(...);
83-
| ^^^^
83+
| ^^^
8484

8585
error: `...` must be the last argument of a C-variadic function
8686
--> $DIR/variadic-ffi-semantic-restrictions.rs:37:13
8787
|
8888
LL | fn e_f2(..., x: isize);
89-
| ^^^^
89+
| ^^^
9090

9191
error: only foreign or `unsafe extern "C" functions may be C-variadic
9292
--> $DIR/variadic-ffi-semantic-restrictions.rs:44:23
9393
|
9494
LL | fn i_f1(x: isize, ...) {}
95-
| ^^^^
95+
| ^^^
9696

9797
error: C-variadic function must be declared with at least one named argument
9898
--> $DIR/variadic-ffi-semantic-restrictions.rs:46:13
9999
|
100100
LL | fn i_f2(...) {}
101-
| ^^^^
101+
| ^^^
102102

103103
error: only foreign or `unsafe extern "C" functions may be C-variadic
104104
--> $DIR/variadic-ffi-semantic-restrictions.rs:46:13
105105
|
106106
LL | fn i_f2(...) {}
107-
| ^^^^
107+
| ^^^
108108

109109
error: `...` must be the last argument of a C-variadic function
110110
--> $DIR/variadic-ffi-semantic-restrictions.rs:49:13
111111
|
112112
LL | fn i_f3(..., x: isize, ...) {}
113-
| ^^^^
113+
| ^^^
114114

115115
error: only foreign or `unsafe extern "C" functions may be C-variadic
116116
--> $DIR/variadic-ffi-semantic-restrictions.rs:49:13
117117
|
118118
LL | fn i_f3(..., x: isize, ...) {}
119-
| ^^^^
119+
| ^^^
120120

121121
error: only foreign or `unsafe extern "C" functions may be C-variadic
122122
--> $DIR/variadic-ffi-semantic-restrictions.rs:49:28
123123
|
124124
LL | fn i_f3(..., x: isize, ...) {}
125-
| ^^^^
125+
| ^^^
126126

127127
error: `...` must be the last argument of a C-variadic function
128128
--> $DIR/variadic-ffi-semantic-restrictions.rs:53:13
129129
|
130130
LL | fn i_f4(..., x: isize, ...) {}
131-
| ^^^^
131+
| ^^^
132132

133133
error: only foreign or `unsafe extern "C" functions may be C-variadic
134134
--> $DIR/variadic-ffi-semantic-restrictions.rs:53:13
135135
|
136136
LL | fn i_f4(..., x: isize, ...) {}
137-
| ^^^^
137+
| ^^^
138138

139139
error: only foreign or `unsafe extern "C" functions may be C-variadic
140140
--> $DIR/variadic-ffi-semantic-restrictions.rs:53:28
141141
|
142142
LL | fn i_f4(..., x: isize, ...) {}
143-
| ^^^^
143+
| ^^^
144144

145145
error: only foreign or `unsafe extern "C" functions may be C-variadic
146146
--> $DIR/variadic-ffi-semantic-restrictions.rs:60:23
147147
|
148148
LL | fn t_f1(x: isize, ...) {}
149-
| ^^^^
149+
| ^^^
150150

151151
error: only foreign or `unsafe extern "C" functions may be C-variadic
152152
--> $DIR/variadic-ffi-semantic-restrictions.rs:62:23
153153
|
154154
LL | fn t_f2(x: isize, ...);
155-
| ^^^^
155+
| ^^^
156156

157157
error: C-variadic function must be declared with at least one named argument
158158
--> $DIR/variadic-ffi-semantic-restrictions.rs:64:13
159159
|
160160
LL | fn t_f3(...) {}
161-
| ^^^^
161+
| ^^^
162162

163163
error: only foreign or `unsafe extern "C" functions may be C-variadic
164164
--> $DIR/variadic-ffi-semantic-restrictions.rs:64:13
165165
|
166166
LL | fn t_f3(...) {}
167-
| ^^^^
167+
| ^^^
168168

169169
error: C-variadic function must be declared with at least one named argument
170170
--> $DIR/variadic-ffi-semantic-restrictions.rs:67:13
171171
|
172172
LL | fn t_f4(...);
173-
| ^^^^
173+
| ^^^
174174

175175
error: only foreign or `unsafe extern "C" functions may be C-variadic
176176
--> $DIR/variadic-ffi-semantic-restrictions.rs:67:13
177177
|
178178
LL | fn t_f4(...);
179-
| ^^^^
179+
| ^^^
180180

181181
error: `...` must be the last argument of a C-variadic function
182182
--> $DIR/variadic-ffi-semantic-restrictions.rs:70:13
183183
|
184184
LL | fn t_f5(..., x: isize) {}
185-
| ^^^^
185+
| ^^^
186186

187187
error: only foreign or `unsafe extern "C" functions may be C-variadic
188188
--> $DIR/variadic-ffi-semantic-restrictions.rs:70:13
189189
|
190190
LL | fn t_f5(..., x: isize) {}
191-
| ^^^^
191+
| ^^^
192192

193193
error: `...` must be the last argument of a C-variadic function
194194
--> $DIR/variadic-ffi-semantic-restrictions.rs:73:13
195195
|
196196
LL | fn t_f6(..., x: isize);
197-
| ^^^^
197+
| ^^^
198198

199199
error: only foreign or `unsafe extern "C" functions may be C-variadic
200200
--> $DIR/variadic-ffi-semantic-restrictions.rs:73:13
201201
|
202202
LL | fn t_f6(..., x: isize);
203-
| ^^^^
203+
| ^^^
204204

205205
error: aborting due to 34 previous errors
206206

0 commit comments

Comments
 (0)