Skip to content
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

Adjust span of fn argument declaration #100458

Merged
merged 1 commit into from
Aug 15, 2022
Merged
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 @@ -2289,7 +2289,7 @@ impl<'a> Parser<'a> {
}
};

let span = lo.until(this.token.span);
let span = lo.to(this.prev_token.span);

Ok((
Param {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/argument-suggestions/complex.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ note: function defined here
--> $DIR/complex.rs:11:4
|
LL | fn complex(_i: u32, _s: &str, _e: E, _f: F, _g: G, _x: X, _y: Y, _z: Z ) {}
| ^^^^^^^ ------- -------- ----- ----- ----- ----- ----- ------
| ^^^^^^^ ------- -------- ----- ----- ----- ----- ----- -----
help: did you mean
|
LL | complex(/* u32 */, &"", /* E */, F::X2, G{}, X {}, Y {}, Z {});
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/c-variadic/issue-86053-1.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ error: `...` must be the last argument of a C-variadic function
--> $DIR/issue-86053-1.rs:11:12
|
LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) {
| ^^^^
| ^^^

error: only foreign or `unsafe extern "C"` functions may be C-variadic
--> $DIR/issue-86053-1.rs:11:12
|
LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) {
| ^^^^
| ^^^

error: only foreign or `unsafe extern "C"` functions may be C-variadic
--> $DIR/issue-86053-1.rs:11:36
|
LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) {
| ^^^^
| ^^^

error[E0412]: cannot find type `F` in this scope
--> $DIR/issue-86053-1.rs:11:48
Expand Down
10 changes: 2 additions & 8 deletions src/test/ui/suggestions/suggest-ref-macro.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,8 @@ LL | #[hello]
note: function defined here
--> $DIR/suggest-ref-macro.rs:8:1
|
LL | #[hello]
| _-^^^^^^^
LL | | fn abc() {}
LL | |
LL | | fn x(_: &mut i32) {}
LL | |
LL | | macro_rules! bla {
| |_____________-
LL | #[hello]
| ^^^^^^^^
= note: this error originates in the attribute macro `hello` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0308]: mismatched types
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error: function can not have more than 65535 arguments
--> $DIR/issue-88577-check-fn-with-more-than-65535-arguments.rs:6:24
--> $DIR/issue-88577-check-fn-with-more-than-65535-arguments.rs:6:22
|
LL | fn _f($($t: ()),*) {}
| ________________________^
LL | | }
LL | | }
LL | |
LL | | many_args!{[_]########## ######}
| |____________^
LL | fn _f($($t: ()),*) {}
| ^
...
LL | many_args!{[_]########## ######}
| -------------------------------- in this macro invocation
|
= note: this error originates in the macro `many_args` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error