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

Remove some trailing semicolons from macro definitions #422

Merged
merged 1 commit into from
Dec 21, 2020

Conversation

Aaron1011
Copy link
Member

This will allow these macros to continue to be used in expression
position if rust-lang/rust#33953 is fixed.

This will allow these macros to continue to be used in expression
position if rust-lang/rust#33953 is fixed.
@Thomasdezeeuw
Copy link
Collaborator

Thomasdezeeuw commented Nov 13, 2020

Even if rust-lang/rust#33953 would be fixed wouldn't this break compatibility with older Rust versions?

@Aaron1011
Copy link
Member Author

No - older versions of Rust will accept the code without a semicolon, since it's still an expression.

@Aaron1011
Copy link
Member Author

A fix for rust-lang/rust#33953 would mean removing this code:

https://github.com/rust-lang/rust/blob/a1f7ca788d28f8df9ccd161137c3429be1ed9d0e/compiler/rustc_expand/src/mbe/macro_rules.rs#L151-L156

This would cause an error (or future-compat) lint to be emitted for code that currently compiles without warnings. However, any code that works with rust-lang/rust#33953 fixed will still work on a compiler that does not have a fix for rust-lang/rust#33953.

@KodrAus
Copy link
Contributor

KodrAus commented Dec 21, 2020

Thanks @Aaron1011!

This looks good to me. I noticed we're not actually testing our macros against our MSRV so will follow up to run those. It includes checking the macros work in expression position so should pick up anything unexpected anyways.

@KodrAus KodrAus merged commit 03b6989 into rust-lang:master Dec 21, 2020
EFanZh pushed a commit to EFanZh/log that referenced this pull request Jul 23, 2023
* Extract `infer_bin_dir_template` and call it once in `collect_bin_files`
* Ensure `product.name.is_some()` is true
* Avoid cloning `str` in `BinFile::from_product`
* Optimize: Take reference in `bins::Data`
* Optimize: Construct `CompactString` only when needed

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants