Skip to content

Commit

Permalink
Merge pull request #60 from dtolnay/issue50
Browse files Browse the repository at this point in the history
Add ui test of current behavior of capture in nested macro
  • Loading branch information
dtolnay authored Feb 11, 2023
2 parents a4179b5 + 9bee3db commit 0661472
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/ui/capture-var-nested.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
use indoc::indoc;

fn main() {
let world = "world";
println!(indoc!("Hello {world}"));
}
8 changes: 8 additions & 0 deletions tests/ui/capture-var-nested.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: there is no argument named `world`
--> tests/ui/capture-var-nested.rs:5:21
|
5 | println!(indoc!("Hello {world}"));
| ^^^^^^^^^^^^^^^
|
= note: did you intend to capture a variable `world` from the surrounding scope?
= note: to avoid ambiguity, `format_args!` cannot capture variables when the format string is expanded from a macro

0 comments on commit 0661472

Please sign in to comment.