about summary refs log tree commit diff
path: root/third_party/nix/src/nix
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/nix/src/nix')
-rw-r--r--third_party/nix/src/nix/edit.cc4
-rw-r--r--third_party/nix/src/nix/installables.cc8
-rw-r--r--third_party/nix/src/nix/repl.cc4
-rw-r--r--third_party/nix/src/nix/search.cc3
-rw-r--r--third_party/nix/src/nix/upgrade-nix.cc5
5 files changed, 13 insertions, 11 deletions
diff --git a/third_party/nix/src/nix/edit.cc b/third_party/nix/src/nix/edit.cc
index a18cba292e00..644caa7cbe82 100644
--- a/third_party/nix/src/nix/edit.cc
+++ b/third_party/nix/src/nix/edit.cc
@@ -30,8 +30,8 @@ struct CmdEdit final : InstallableCommand {
 
     Value* v2;
     try {
-      auto dummyArgs = Bindings::NewGC();
-      v2 = findAlongAttrPath(*state, "meta.position", *dummyArgs, *v);
+      auto dummyArgs = Bindings::New();
+      v2 = findAlongAttrPath(*state, "meta.position", dummyArgs.get(), *v);
     } catch (Error&) {
       throw Error("package '%s' has no source location information",
                   installable->what());
diff --git a/third_party/nix/src/nix/installables.cc b/third_party/nix/src/nix/installables.cc
index b257a26f23af..dd1202586ad1 100644
--- a/third_party/nix/src/nix/installables.cc
+++ b/third_party/nix/src/nix/installables.cc
@@ -122,10 +122,10 @@ struct InstallableValue : Installable {
 
     auto v = toValue(*state);
 
-    Bindings& autoArgs = *cmd.getAutoArgs(*state);
+    std::unique_ptr<Bindings> autoArgs = cmd.getAutoArgs(*state);
 
     DrvInfos drvs;
-    getDerivations(*state, *v, "", autoArgs, drvs, false);
+    getDerivations(*state, *v, "", autoArgs.get(), drvs, false);
 
     Buildables res;
 
@@ -185,9 +185,9 @@ struct InstallableAttrPath final : InstallableValue {
   Value* toValue(EvalState& state) override {
     auto source = cmd.getSourceExpr(state);
 
-    Bindings& autoArgs = *cmd.getAutoArgs(state);
+    std::unique_ptr<Bindings> autoArgs = cmd.getAutoArgs(state);
 
-    Value* v = findAlongAttrPath(state, attrPath, autoArgs, *source);
+    Value* v = findAlongAttrPath(state, attrPath, autoArgs.get(), *source);
     state.forceValue(*v);
 
     return v;
diff --git a/third_party/nix/src/nix/repl.cc b/third_party/nix/src/nix/repl.cc
index 85750b08cea4..2607655f9b6b 100644
--- a/third_party/nix/src/nix/repl.cc
+++ b/third_party/nix/src/nix/repl.cc
@@ -35,7 +35,7 @@ namespace nix {
 struct NixRepl {
   std::string curDir;
   EvalState state;
-  Bindings* autoArgs;
+  std::unique_ptr<Bindings> autoArgs;
 
   Strings loadedFiles;
 
@@ -575,7 +575,7 @@ void NixRepl::loadFile(const Path& path) {
   Value v;
   Value v2;
   state.evalFile(lookupFileArg(state, path), v);
-  state.autoCallFunction(*autoArgs, v, v2);
+  state.autoCallFunction(autoArgs.get(), v, v2);
   addAttrsToScope(v2);
 }
 
diff --git a/third_party/nix/src/nix/search.cc b/third_party/nix/src/nix/search.cc
index 06d5c207e56b..9db5b3d103f9 100644
--- a/third_party/nix/src/nix/search.cc
+++ b/third_party/nix/src/nix/search.cc
@@ -110,7 +110,8 @@ struct CmdSearch final : SourceExprCommand, MixJSON {
 
         if (v->type == tLambda && toplevel) {
           Value* v2 = state->allocValue();
-          state->autoCallFunction(*Bindings::NewGC(), *v, *v2);
+          auto dummyArgs = Bindings::New();
+          state->autoCallFunction(dummyArgs.get(), *v, *v2);
           v = v2;
           state->forceValue(*v);
         }
diff --git a/third_party/nix/src/nix/upgrade-nix.cc b/third_party/nix/src/nix/upgrade-nix.cc
index 158e3cd1c2f8..eff51ba158f0 100644
--- a/third_party/nix/src/nix/upgrade-nix.cc
+++ b/third_party/nix/src/nix/upgrade-nix.cc
@@ -156,8 +156,9 @@ struct CmdUpgradeNix final : MixDryRun, StoreCommand {
     auto state = std::make_unique<EvalState>(Strings(), store);
     auto v = state->allocValue();
     state->eval(state->parseExprFromString(*res.data, "/no-such-path"), *v);
-    Bindings& bindings(*Bindings::NewGC());
-    auto v2 = findAlongAttrPath(*state, settings.thisSystem, bindings, *v);
+    std::unique_ptr<Bindings> bindings(Bindings::New());
+    auto v2 =
+        findAlongAttrPath(*state, settings.thisSystem, bindings.get(), *v);
 
     return state->forceString(*v2);
   }