summaryrefslogtreecommitdiffstats
path: root/tests/ui/fmt/format-string-wrong-order.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/fmt/format-string-wrong-order.rs')
-rw-r--r--tests/ui/fmt/format-string-wrong-order.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/fmt/format-string-wrong-order.rs b/tests/ui/fmt/format-string-wrong-order.rs
new file mode 100644
index 000000000..0bad54023
--- /dev/null
+++ b/tests/ui/fmt/format-string-wrong-order.rs
@@ -0,0 +1,15 @@
+fn main() {
+ let bar = 3;
+ format!("{?:}", bar);
+ //~^ ERROR invalid format string: expected format parameter to occur after `:`
+ format!("{?:bar}");
+ //~^ ERROR invalid format string: expected format parameter to occur after `:`
+ format!("{?:?}", bar);
+ //~^ ERROR invalid format string: expected format parameter to occur after `:`
+ format!("{??}", bar);
+ //~^ ERROR invalid format string: expected `'}'`, found `'?'`
+ format!("{?;bar}");
+ //~^ ERROR invalid format string: expected `'}'`, found `'?'`
+ format!("{?:#?}", bar);
+ //~^ ERROR invalid format string: expected format parameter to occur after `:`
+}