aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/outputs-spec.hh
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-01-12 20:41:29 -0500
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-01-12 20:52:29 -0500
commitd29eb085630aac6cbefeafe51937314ce0263593 (patch)
tree73bf197192ee6cbeb539d9c69d735bde68079878 /src/libstore/outputs-spec.hh
parente947aa540129441ebb3df1980c9ba05a935473ca (diff)
Assert on construction that `OutputsSpec::Names` is non-empty
Diffstat (limited to 'src/libstore/outputs-spec.hh')
-rw-r--r--src/libstore/outputs-spec.hh9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libstore/outputs-spec.hh b/src/libstore/outputs-spec.hh
index 82dfad479..46bc35ebc 100644
--- a/src/libstore/outputs-spec.hh
+++ b/src/libstore/outputs-spec.hh
@@ -1,5 +1,6 @@
#pragma once
+#include <cassert>
#include <optional>
#include <set>
#include <variant>
@@ -11,13 +12,15 @@ namespace nix {
struct OutputNames : std::set<std::string> {
using std::set<std::string>::set;
- // These need to be "inherited manually"
+ /* These need to be "inherited manually" */
+
OutputNames(const std::set<std::string> & s)
: std::set<std::string>(s)
- { }
+ { assert(!empty()); }
+
OutputNames(std::set<std::string> && s)
: std::set<std::string>(s)
- { }
+ { assert(!empty()); }
/* This set should always be non-empty, so we delete this
constructor in order make creating empty ones by mistake harder.