1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 10:41:16 +02:00

turn primop names into strings

we don't *need* symbols here. the only advantage they have over strings is
making call-counting slightly faster, but that's a diagnostic feature and thus
needn't be optimized.

this also fixes a move bug that previously didn't show up: PrimOp structs were
accessed after being moved from, which technically invalidates them. previously
the names remained valid because Symbol copies on move, but strings are
invalidated. we now copy the entire primop struct instead of moving since primop
registration happen once and are not performance-sensitive.
This commit is contained in:
pennae 2022-03-05 19:26:36 +01:00
parent 3b9d31b88c
commit 90b5c0a1a6
3 changed files with 11 additions and 11 deletions

View file

@ -3906,7 +3906,7 @@ void EvalState::createBaseEnv()
addPrimOp({
.fun = primOp.fun,
.arity = std::max(primOp.args.size(), primOp.arity),
.name = symbols.create(primOp.name),
.name = primOp.name,
.args = primOp.args,
.doc = primOp.doc,
});