From 74a144ce9831c65371f7482fc6ae748872df679d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 10 Jul 2025 11:53:36 +0200 Subject: [PATCH 1/3] Require Boost 1.81.0 or higher Note: this version of Boost was released in December 2022. --- src/libexpr/include/nix/expr/symbol-table.hh | 14 +------------- src/libexpr/meson.build | 1 + src/libutil/serialise.cc | 4 ---- 3 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/libexpr/include/nix/expr/symbol-table.hh b/src/libexpr/include/nix/expr/symbol-table.hh index 20a05a09d..1249bdb88 100644 --- a/src/libexpr/include/nix/expr/symbol-table.hh +++ b/src/libexpr/include/nix/expr/symbol-table.hh @@ -7,12 +7,7 @@ #include "nix/util/error.hh" #include -#define USE_FLAT_SYMBOL_SET (BOOST_VERSION >= 108100) -#if USE_FLAT_SYMBOL_SET -# include -#else -# include -#endif +#include namespace nix { @@ -214,12 +209,7 @@ private: * Transparent lookup of string view for a pointer to a ChunkedVector entry -> return offset into the store. * ChunkedVector references are never invalidated. */ -#if USE_FLAT_SYMBOL_SET boost::unordered_flat_set symbols{SymbolStr::chunkSize}; -#else - using SymbolValueAlloc = std::pmr::polymorphic_allocator; - boost::unordered_set symbols{SymbolStr::chunkSize, {&buffer}}; -#endif public: @@ -287,5 +277,3 @@ struct std::hash return std::hash{}(s.id); } }; - -#undef USE_FLAT_SYMBOL_SET diff --git a/src/libexpr/meson.build b/src/libexpr/meson.build index f5adafae0..533030359 100644 --- a/src/libexpr/meson.build +++ b/src/libexpr/meson.build @@ -41,6 +41,7 @@ boost = dependency( 'boost', modules : ['container', 'context'], include_type: 'system', + version: '>=1.81.0' ) # boost is a public dependency, but not a pkg-config dependency unfortunately, so we # put in `deps_other`. diff --git a/src/libutil/serialise.cc b/src/libutil/serialise.cc index 55397c6d4..a74531582 100644 --- a/src/libutil/serialise.cc +++ b/src/libutil/serialise.cc @@ -194,10 +194,6 @@ size_t StringSource::read(char * data, size_t len) } -#if BOOST_VERSION >= 106300 && BOOST_VERSION < 106600 -#error Coroutines are broken in this version of Boost! -#endif - std::unique_ptr sourceToSink(std::function fun) { struct SourceToSink : FinishSink From ca9f2028b020447559d509252c31a145f92dfaff Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 10 Jul 2025 12:27:17 +0200 Subject: [PATCH 2/3] Simplify SymbolTable::create() --- src/libexpr/include/nix/expr/symbol-table.hh | 14 +------------- src/libexpr/meson.build | 2 +- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/libexpr/include/nix/expr/symbol-table.hh b/src/libexpr/include/nix/expr/symbol-table.hh index 1249bdb88..4dedf3d91 100644 --- a/src/libexpr/include/nix/expr/symbol-table.hh +++ b/src/libexpr/include/nix/expr/symbol-table.hh @@ -220,19 +220,7 @@ public: // Most symbols are looked up more than once, so we trade off insertion performance // for lookup performance. // FIXME: make this thread-safe. - return [&](T && key) -> Symbol { - if constexpr (requires { symbols.insert(key); }) { - auto [it, _] = symbols.insert(key); - return Symbol(*it); - } else { - auto it = symbols.find(key); - if (it != symbols.end()) - return Symbol(*it); - - it = symbols.emplace(key).first; - return Symbol(*it); - } - }(SymbolStr::Key{store, s, stringAlloc}); + return Symbol(*symbols.insert(SymbolStr::Key{store, s, stringAlloc}).first); } std::vector resolve(const std::vector & symbols) const diff --git a/src/libexpr/meson.build b/src/libexpr/meson.build index 533030359..43e4b9c98 100644 --- a/src/libexpr/meson.build +++ b/src/libexpr/meson.build @@ -41,7 +41,7 @@ boost = dependency( 'boost', modules : ['container', 'context'], include_type: 'system', - version: '>=1.81.0' + version: '>=1.82.0' ) # boost is a public dependency, but not a pkg-config dependency unfortunately, so we # put in `deps_other`. From 6abc29bba526c426bdaf4477d0740d877ac53294 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 15 Jul 2025 15:17:33 +0200 Subject: [PATCH 3/3] Move boost version check to libutil --- src/libexpr/meson.build | 1 - src/libutil/meson.build | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libexpr/meson.build b/src/libexpr/meson.build index 43e4b9c98..f5adafae0 100644 --- a/src/libexpr/meson.build +++ b/src/libexpr/meson.build @@ -41,7 +41,6 @@ boost = dependency( 'boost', modules : ['container', 'context'], include_type: 'system', - version: '>=1.82.0' ) # boost is a public dependency, but not a pkg-config dependency unfortunately, so we # put in `deps_other`. diff --git a/src/libutil/meson.build b/src/libutil/meson.build index f5ad2b1f6..f48c8f3d7 100644 --- a/src/libutil/meson.build +++ b/src/libutil/meson.build @@ -59,6 +59,7 @@ boost = dependency( 'boost', modules : ['context', 'coroutine', 'iostreams'], include_type: 'system', + version: '>=1.82.0' ) # boost is a public dependency, but not a pkg-config dependency unfortunately, so we # put in `deps_other`.