Skip to content

Commit

Permalink
Specify the size of the experimental feature array in a more robust way
Browse files Browse the repository at this point in the history
See doc comment for details.
  • Loading branch information
Ericson2314 committed Nov 6, 2023
1 parent 49d2c8d commit 71f1028
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/libutil/experimental-features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,19 @@ struct ExperimentalFeatureDetails
std::string_view description;
};

constexpr std::array<ExperimentalFeatureDetails, 16> xpFeatureDetails = {{
/**
* If two different PRs both add an experimental feature, and we just
* used a number for this, we *woudln't* get merge conflict and the
* counter will be incremented once instead of twice, causing a build
* failure.
*
* By instead defining this instead as 1 + the bottom experimental
* feature, we either have no issue at all if few features are not added
* at the end of the list, or a proper merge conflict if they are.
*/
constexpr size_t numXpFeatures = 1 + static_cast<size_t>(Xp::VerifiedFetches);

constexpr std::array<ExperimentalFeatureDetails, numXpFeatures> xpFeatureDetails = {{
{
.tag = Xp::CaDerivations,
.name = "ca-derivations",
Expand Down

0 comments on commit 71f1028

Please sign in to comment.