From edf9163c2259b7267d9b3fe39347a22744ecdb8b Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Tue, 14 Oct 2025 02:24:03 +0300 Subject: [PATCH] libutil: Make CanonPath::root const By all means CanonPath::root must be immutable. Let's enforce this with in the code. --- src/libutil/canon-path.cc | 2 +- src/libutil/include/nix/util/canon-path.hh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libutil/canon-path.cc b/src/libutil/canon-path.cc index 07a3a6193..3b4777ef7 100644 --- a/src/libutil/canon-path.cc +++ b/src/libutil/canon-path.cc @@ -5,7 +5,7 @@ namespace nix { -CanonPath CanonPath::root = CanonPath("/"); +const CanonPath CanonPath::root = CanonPath("/"); static std::string absPathPure(std::string_view path) { diff --git a/src/libutil/include/nix/util/canon-path.hh b/src/libutil/include/nix/util/canon-path.hh index dd07929b4..a9c173d71 100644 --- a/src/libutil/include/nix/util/canon-path.hh +++ b/src/libutil/include/nix/util/canon-path.hh @@ -69,7 +69,7 @@ public: */ CanonPath(const std::vector & elems); - static CanonPath root; + static const CanonPath root; /** * If `raw` starts with a slash, return