about summary refs log tree commit diff
path: root/src/test/ui/macros/unreachable-format-arg.rs
diff options
context:
space:
mode:
authorLoïc BRANSTETT <lolo.branstett@numericable.fr>2022-01-21 23:04:06 +0100
committerLoïc BRANSTETT <lolo.branstett@numericable.fr>2022-01-31 17:09:31 +0100
commit565710b33cb20c901b8b3371d1364cf7fb11e79b (patch)
treeea8b01a50153f7188172d0a924b86fa30471d4a2 /src/test/ui/macros/unreachable-format-arg.rs
parent86f5e177bca8121e1edc9864023a8ea61acf9034 (diff)
downloadrust-565710b33cb20c901b8b3371d1364cf7fb11e79b.tar.gz
rust-565710b33cb20c901b8b3371d1364cf7fb11e79b.zip
Fix invalid special casing of the unreachable! macro
Diffstat (limited to 'src/test/ui/macros/unreachable-format-arg.rs')
-rw-r--r--src/test/ui/macros/unreachable-format-arg.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/ui/macros/unreachable-format-arg.rs b/src/test/ui/macros/unreachable-format-arg.rs
new file mode 100644
index 00000000000..7d83b698d79
--- /dev/null
+++ b/src/test/ui/macros/unreachable-format-arg.rs
@@ -0,0 +1,13 @@
+// run-fail
+// ignore-emscripten no processes
+
+// revisions: edition_2015 edition_2021
+// [edition_2015]edition:2015
+// [edition_2021]edition:2021
+// [edition_2015]error-pattern:internal error: entered unreachable code: x is {x}
+// [edition_2021]error-pattern:internal error: entered unreachable code: x is 5
+
+fn main() {
+    let x = 5;
+    unreachable!("x is {x}");
+}