]> git.lizzy.rs Git - rust.git/blob - tests/ui/fmt/format-args-capture-macro-hygiene.rs
Rollup merge of #107172 - cjgillot:no-nal, r=nagisa
[rust.git] / tests / ui / fmt / format-args-capture-macro-hygiene.rs
1 // aux-build:format-string-proc-macro.rs
2
3 #[macro_use]
4 extern crate format_string_proc_macro;
5
6 macro_rules! def_site {
7     () => { "{foo}" } //~ ERROR: there is no argument named `foo`
8 }
9
10 macro_rules! call_site {
11     ($fmt:literal) => { $fmt }
12 }
13
14 fn main() {
15     format!(concat!("{foo}"));         //~ ERROR: there is no argument named `foo`
16     format!(concat!("{ba", "r} {}"), 1);     //~ ERROR: there is no argument named `bar`
17
18     format!(def_site!());
19     format!(call_site!("{foo}")); //~ ERROR: there is no argument named `foo`
20
21     format!(foo_with_input_span!("")); //~ ERROR: there is no argument named `foo`
22 }