From 95daa068f10ac01482cc654bb211e93ab7b56445 Mon Sep 17 00:00:00 2001 From: Andy Russell Date: Sat, 26 Sep 2020 13:46:00 -0400 Subject: [PATCH] fix off-by-one in parameter spans --- compiler/rustc_parse/src/parser/item.rs | 2 +- .../variadic-ffi-no-fixed-args.stderr | 2 +- .../ui/mismatched_types/issue-38371.stderr | 2 +- .../variadic-ffi-semantic-restrictions.stderr | 68 +++++++++---------- 4 files changed, 37 insertions(+), 37 deletions(-) diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 26ca9980127..48341f71d33 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -1744,7 +1744,7 @@ fn parse_param_general(&mut self, req_name: ReqName, first_param: bool) -> PResu } }; - let span = lo.to(self.token.span); + let span = lo.until(self.token.span); Ok(Param { attrs: attrs.into(), diff --git a/src/test/ui/c-variadic/variadic-ffi-no-fixed-args.stderr b/src/test/ui/c-variadic/variadic-ffi-no-fixed-args.stderr index 7af38c88f43..e11ba43ca2a 100644 --- a/src/test/ui/c-variadic/variadic-ffi-no-fixed-args.stderr +++ b/src/test/ui/c-variadic/variadic-ffi-no-fixed-args.stderr @@ -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 diff --git a/src/test/ui/mismatched_types/issue-38371.stderr b/src/test/ui/mismatched_types/issue-38371.stderr index c2bce305877..5d2ce9302ec 100644 --- a/src/test/ui/mismatched_types/issue-38371.stderr +++ b/src/test/ui/mismatched_types/issue-38371.stderr @@ -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 diff --git a/src/test/ui/parser/variadic-ffi-semantic-restrictions.stderr b/src/test/ui/parser/variadic-ffi-semantic-restrictions.stderr index 21992a29670..3f3ddfed14a 100644 --- a/src/test/ui/parser/variadic-ffi-semantic-restrictions.stderr +++ b/src/test/ui/parser/variadic-ffi-semantic-restrictions.stderr @@ -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 -- 2.44.0