mirror of
https://github.com/NixOS/nix
synced 2025-06-25 06:31:14 +02:00
use singleton expr to generate black hole errors
this also reduces forceValue code size and removes the need for hideInDiagnostics. coopting thunk forcing like this has the additional benefit of clarifying how these errors can happen in the first place.
This commit is contained in:
parent
f9db4de0f3
commit
2b0e95e7aa
8 changed files with 51 additions and 61 deletions
|
@ -4263,29 +4263,6 @@ static RegisterPrimOp primop_splitVersion({
|
|||
});
|
||||
|
||||
|
||||
static void prim_blackHoleFn(EvalState & state, const PosIdx pos, Value * * args, Value & v)
|
||||
{
|
||||
state.error("infinite recursion encountered")
|
||||
.debugThrow<InfiniteRecursionError>();
|
||||
}
|
||||
|
||||
static PrimOp primop_blackHole = {
|
||||
.name = "«blackHole»",
|
||||
.args = {},
|
||||
.fun = prim_blackHoleFn,
|
||||
.hideInDiagnostics = true,
|
||||
};
|
||||
|
||||
static Value makeBlackHole()
|
||||
{
|
||||
Value v;
|
||||
v.mkPrimOp(&primop_blackHole);
|
||||
return v;
|
||||
}
|
||||
|
||||
Value prim_blackHole = makeBlackHole();
|
||||
|
||||
|
||||
/*************************************************************
|
||||
* Primop registration
|
||||
*************************************************************/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue