{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rfcs/issues/2334","repository_url":"https://api.github.com/repos/rust-lang/rfcs","labels_url":"https://api.github.com/repos/rust-lang/rfcs/issues/2334/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rfcs/issues/2334/comments","events_url":"https://api.github.com/repos/rust-lang/rfcs/issues/2334/events","html_url":"https://github.com/rust-lang/rfcs/issues/2334","id":296966568,"node_id":"MDU6SXNzdWUyOTY5NjY1Njg=","number":2334,"title":"Extend macro_rules! to make macros with pre-bracket items","user":{"login":"Nokel81","id":8225332,"node_id":"MDQ6VXNlcjgyMjUzMzI=","avatar_url":"https://avatars2.githubusercontent.com/u/8225332?v=4","gravatar_id":"","url":"https://api.github.com/users/Nokel81","html_url":"https://github.com/Nokel81","followers_url":"https://api.github.com/users/Nokel81/followers","following_url":"https://api.github.com/users/Nokel81/following{/other_user}","gists_url":"https://api.github.com/users/Nokel81/gists{/gist_id}","starred_url":"https://api.github.com/users/Nokel81/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nokel81/subscriptions","organizations_url":"https://api.github.com/users/Nokel81/orgs","repos_url":"https://api.github.com/users/Nokel81/repos","events_url":"https://api.github.com/users/Nokel81/events{/privacy}","received_events_url":"https://api.github.com/users/Nokel81/received_events","type":"User","site_admin":false},"labels":[{"id":211667886,"node_id":"MDU6TGFiZWwyMTE2Njc4ODY=","url":"https://api.github.com/repos/rust-lang/rfcs/labels/T-lang","name":"T-lang","color":"bfd4f2","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-02-14T03:45:29Z","updated_at":"2018-10-09T01:01:41Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Currently the `macro_rules` macro is used as the following:\r\n\r\n```rust\r\nmacro_rules! name {\r\n    pattern => code;\r\n    ...\r\n}\r\n```\r\n\r\nWhich produces a macro that is used: `name!{pattern}`.\r\n\r\nThis proposal would allow for syntax within the `macro_rules!` macro creator for macros that have some patterns before the initial brackets. I think that it would also be nice if it was possible to control which of the three `{}`, `[]`, `()` bracket types were allowed to be used with the with the macro, by default all three would be allowed.\n\nAs more information was requested, read below:\n\nMotivation:\nFor some macros it would make sense for there to be a visual distinction between some parts of the macro. These are generally identifiers or other similar overarching aspects of them. \n\nExplanation:\nThis is a proposal to facilitate both allowing some pattern matching before the start of the main brackets as well as which type(s) of brackets are allowed to be used. This would act similarly to how the `macro_rules` macro works where the identifier of the new macro is situated before the start of the brackets that contain the pattern branches.\n\nExample:\nMaybe not the best example but I believe that it shows the point rather well\n\n```rust\nunless! item.is_empty() { continue; }\n```\n\nInstead of something like the following (what is currently available easily):\n\n```rust\nunless! { item.is_empty() -> { continue; } }\n```\n"},"comment":{"url":"https://api.github.com/repos/rust-lang/rfcs/issues/comments/428025486","html_url":"https://github.com/rust-lang/rfcs/issues/2334#issuecomment-428025486","issue_url":"https://api.github.com/repos/rust-lang/rfcs/issues/2334","id":428025486,"node_id":"MDEyOklzc3VlQ29tbWVudDQyODAyNTQ4Ng==","user":{"login":"Centril","id":855702,"node_id":"MDQ6VXNlcjg1NTcwMg==","avatar_url":"https://avatars2.githubusercontent.com/u/855702?v=4","gravatar_id":"","url":"https://api.github.com/users/Centril","html_url":"https://github.com/Centril","followers_url":"https://api.github.com/users/Centril/followers","following_url":"https://api.github.com/users/Centril/following{/other_user}","gists_url":"https://api.github.com/users/Centril/gists{/gist_id}","starred_url":"https://api.github.com/users/Centril/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Centril/subscriptions","organizations_url":"https://api.github.com/users/Centril/orgs","repos_url":"https://api.github.com/users/Centril/repos","events_url":"https://api.github.com/users/Centril/events{/privacy}","received_events_url":"https://api.github.com/users/Centril/received_events","type":"User","site_admin":false},"created_at":"2018-10-09T01:01:41Z","updated_at":"2018-10-09T01:01:41Z","author_association":"CONTRIBUTOR","body":"cc https://github.com/rust-lang/rust/issues/39412"}}
{"actor":{"display_login":"Centril"}}