aboutsummaryrefslogtreecommitdiff
path: root/src/Util/Tactics
diff options
context:
space:
mode:
Diffstat (limited to 'src/Util/Tactics')
-rw-r--r--src/Util/Tactics/ConstrFail.v9
-rw-r--r--src/Util/Tactics/DebugPrint.v4
2 files changed, 12 insertions, 1 deletions
diff --git a/src/Util/Tactics/ConstrFail.v b/src/Util/Tactics/ConstrFail.v
new file mode 100644
index 000000000..fe8a05630
--- /dev/null
+++ b/src/Util/Tactics/ConstrFail.v
@@ -0,0 +1,9 @@
+(** A tactic that executes immediately (during expression evaluation / constr-construction) and fails. Ideally we can eventually give it a nicer error message. COQBUG(3913) *)
+
+Ltac constr_fail :=
+ let __ := match goal with _ => fail 1 "Constr construction failed. Please look at the message log (*coq*, or run your tactic again inside Fail or try) to see more details" end in
+ ().
+
+Ltac constr_fail_with msg_tac :=
+ let __ := match goal with _ => msg_tac () end in
+ constr_fail.
diff --git a/src/Util/Tactics/DebugPrint.v b/src/Util/Tactics/DebugPrint.v
index 3ced23331..97edd0ad9 100644
--- a/src/Util/Tactics/DebugPrint.v
+++ b/src/Util/Tactics/DebugPrint.v
@@ -1,3 +1,5 @@
+Require Import Crypto.Util.Tactics.ConstrFail.
+
Ltac debuglevel := constr:(0%nat).
Ltac solve_debugfail tac :=
@@ -36,7 +38,7 @@ Ltac constr_run_tac_fail tac :=
let dummy := match goal with
| _ => tac ()
end in
- constr:(I : I).
+ constr_fail.
Ltac cidtac msg :=
constr_run_tac ltac:(fun _ => idtac msg).