forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#64894 - Centril:fix-64682, r=petrochenkov
syntax: fix dropping of attribute on first param of non-method assocated fn Fixes rust-lang#64682. The general idea is that we bake parsing of `self` into `parse_param_general` and then we just use standard list parsing. Overall, this simplifies the parsing and makes it more consistent. r? @petrochenkov cc @c410-f3r
- Loading branch information
Showing
15 changed files
with
391 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#[cfg(FALSE)] | ||
impl S { | ||
fn f(#[attr]) {} //~ ERROR expected parameter name, found `)` | ||
} | ||
|
||
#[cfg(FALSE)] | ||
impl T for S { | ||
fn f(#[attr]) {} //~ ERROR expected parameter name, found `)` | ||
} | ||
|
||
#[cfg(FALSE)] | ||
trait T { | ||
fn f(#[attr]); //~ ERROR expected argument name, found `)` | ||
} | ||
|
||
fn main() {} |
20 changes: 20 additions & 0 deletions
20
src/test/ui/rfc-2565-param-attrs/attr-without-param.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
error: expected parameter name, found `)` | ||
--> $DIR/attr-without-param.rs:3:17 | ||
| | ||
LL | fn f(#[attr]) {} | ||
| ^ expected parameter name | ||
|
||
error: expected parameter name, found `)` | ||
--> $DIR/attr-without-param.rs:8:17 | ||
| | ||
LL | fn f(#[attr]) {} | ||
| ^ expected parameter name | ||
|
||
error: expected argument name, found `)` | ||
--> $DIR/attr-without-param.rs:13:17 | ||
| | ||
LL | fn f(#[attr]); | ||
| ^ expected argument name | ||
|
||
error: aborting due to 3 previous errors | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/test/ui/rfc-2565-param-attrs/issue-64682-dropping-first-attrs-in-impl-fns.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// aux-build:param-attrs.rs | ||
|
||
// check-pass | ||
|
||
extern crate param_attrs; | ||
|
||
use param_attrs::rename_params; | ||
|
||
#[rename_params(send_help)] | ||
impl Foo { | ||
fn hello(#[angery(true)] a: i32, #[a2] b: i32, #[what = "how"] c: u32) {} | ||
fn hello2(#[a1] #[a2] a: i32, #[what = "how"] b: i32, #[angery(true)] c: u32) {} | ||
fn hello_self( | ||
#[a1] #[a2] &self, | ||
#[a1] #[a2] a: i32, | ||
#[what = "how"] b: i32, | ||
#[angery(true)] c: u32 | ||
) {} | ||
} | ||
|
||
fn main() {} |
Oops, something went wrong.