Skip to content

Commit

Permalink
Add ui test of current behavior of capture in nested macro
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Feb 11, 2023
1 parent a4179b5 commit 9bee3db
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
@@ -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
@@ -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 9bee3db

Please sign in to comment.