summary refs log tree commit diff
path: root/lib/trivial.nix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/trivial.nix')
-rw-r--r--lib/trivial.nix40
1 files changed, 1 insertions, 39 deletions
diff --git a/lib/trivial.nix b/lib/trivial.nix
index f1001ee10ca3..b1eea0bf1247 100644
--- a/lib/trivial.nix
+++ b/lib/trivial.nix
@@ -171,7 +171,7 @@ rec {
     builtins.fromJSON (builtins.readFile path);
 
 
-  ## Warnings and asserts
+  ## Warnings
 
   /* See https://github.com/NixOS/nix/issues/749. Eventually we'd like these
      to expand to Nix builtins that carry metadata so that Nix can filter out
@@ -188,44 +188,6 @@ rec {
   warn = msg: builtins.trace "WARNING: ${msg}";
   info = msg: builtins.trace "INFO: ${msg}";
 
-  /* Print a trace message if pred is false.
-     Intended to be used to augment asserts with helpful error messages.
-
-     Example:
-       assertMsg false "nope"
-       => false
-       stderr> trace: nope
-
-       assert (assertMsg ("foo" == "bar") "foo is not bar, silly"); ""
-       stderr> trace: foo is not bar, silly
-       stderr> assert failed at …
-
-     Type:
-       assertMsg :: Bool -> String -> Bool
-  */
-  # TODO(Profpatsch): add tests that check stderr
-  assertMsg = pred: msg:
-    if pred
-    then true
-    else builtins.trace msg false;
-
-  /* Specialized `assertMsg` for checking if val is one of the elements
-     of a list. Useful for checking enums.
-
-     Example:
-       let sslLibrary = "libressl"
-       in assertOneOf "sslLibrary" sslLibrary [ "openssl" "bearssl" ]
-       => false
-       stderr> trace: sslLibrary must be one of "openssl", "bearssl", but is: "libressl"
-
-     Type:
-       assertOneOf :: String -> ComparableVal -> List ComparableVal -> Bool
-  */
-  assertOneOf = name: val: xs: assertMsg
-    (lib.elem val xs)
-    "${name} must be one of ${
-      lib.generators.toPretty {} xs}, but is: ${
-        lib.generators.toPretty {} val}";
 
   ## Function annotations