]> git.lizzy.rs Git - rust.git/blob - tests/ui/fmt/format-expanded-string.rs
Rollup merge of #104672 - Voultapher:unify-sort-modules, r=thomcc
[rust.git] / tests / ui / fmt / format-expanded-string.rs
1 // aux-build:format-string-proc-macro.rs
2
3 #[macro_use]
4 extern crate format_string_proc_macro;
5
6
7 // If the format string is another macro invocation, rustc would previously
8 // compute nonsensical spans, such as:
9 //
10 //   error: invalid format string: unmatched `}` found
11 //    --> test.rs:2:17
12 //     |
13 //   2 |     format!(concat!("abc}"));
14 //     |                 ^ unmatched `}` in format string
15 //
16 // This test checks that this behavior has been fixed.
17
18 fn main() {
19     format!(concat!("abc}"));
20     //~^ ERROR: invalid format string: unmatched `}` found
21
22     format!(err_with_input_span!(""));
23     //~^ ERROR: invalid format string: unmatched `}` found
24 }