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

Add more Rust-like macros #142

Merged
merged 1 commit into from
Oct 8, 2020
Merged

Add more Rust-like macros #142

merged 1 commit into from
Oct 8, 2020

Conversation

udoprog
Copy link
Collaborator

@udoprog udoprog commented Oct 8, 2020

This introduces FormatArgs as a utility type to parse and expand format arguments.

It is now used in panic!, assert_eq!, and assert! to allow for formatting a message there, like with the Rust macros:

let food = "Tofu";
panic!("I sure do like {food}", food = food);

I've also suppressed the warning about using a template without expansions. This is accomplished by adding a parameter to builtin, like #[builtin(literal)] which signals that the template was caused by a literal and appropriately should generate warnings. The warning is not emitted otherwise.

@udoprog udoprog merged commit acc47a3 into master Oct 8, 2020
@udoprog udoprog deleted the more-rust-macros branch October 8, 2020 22:01
@udoprog udoprog added the changelog Issue has been added to the changelog label Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog Issue has been added to the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant