rust-lang / rust-lang/rust-by-example
Chapter 17.3 DSL: Curly braces in macro invocation
Open
Nobody has claimed this yet.
- Dominant language
- Handlebars
- Stars
- 8.1k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
in this code snippet
macro_rules! calculate {
(eval $e:expr) => {
{
let val: usize = $e; // Force types to be unsigned integers
println!("{} = {}", stringify!{$e}, val);
}
};
}
what is the implication of using curly braces with stringify! ? Looks like those do not change program behaviour in any way, compared to normal parentheses.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Chapter 17.3 and the shown macro_rules! example, focusing on the stringify! invocation and its curly braces. Verify whether curly braces and parentheses differ in this context, then clarify the chapter so the delimiter behavior and any effect on the program are explicit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100