Skip to content

fix off-by-one in parameter spans #77237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_parse/src/parser/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1744,7 +1744,7 @@ impl<'a> Parser<'a> {
}
};

let span = lo.to(self.token.span);
let span = lo.until(self.token.span);

Ok(Param {
attrs: attrs.into(),
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/c-variadic/variadic-ffi-no-fixed-args.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error: C-variadic function must be declared with at least one named argument
--> $DIR/variadic-ffi-no-fixed-args.rs:2:12
|
LL | fn foo(...);
| ^^^^
| ^^^

error: aborting due to previous error

2 changes: 1 addition & 1 deletion src/test/ui/mismatched_types/issue-38371.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-38371.rs:4:8
|
LL | fn foo(&foo: Foo) {
| ^^^^------
| ^^^^-----
| | |
| | expected due to this
| expected struct `Foo`, found reference
Expand Down
68 changes: 34 additions & 34 deletions src/test/ui/parser/variadic-ffi-semantic-restrictions.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,205 +2,205 @@ error: only foreign or `unsafe extern "C" functions may be C-variadic
--> $DIR/variadic-ffi-semantic-restrictions.rs:5:19
|
LL | fn f1_1(x: isize, ...) {}
| ^^^^
| ^^^

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

error: aborting due to 34 previous errors