Commit graph

9 commits

Author SHA1 Message Date
Robert Hensing
a6dbf17778 fix: Require mutable Context, as it should be
This spreads out transitively to many places and requires that
we use `check_call!` instead of `check_one_call` in a number of
places.

(cherry picked from commit 6bc31dcf206518a7be7f0ac6e773d5dfe25531ea)
2025-10-04 02:31:16 +02:00
Taeer Bar-Yam
226639939f feat: nix_util::context::check_call!(func[...])
> I couldn't figure out a way to use () for the function call, but I didn't try that hard.

I (Robert) have also given it a shot, briefly, unsuccessfully.

While I was critical of over-engineering this, it turns out that
when we start to use `mut`, a macro is much more practical, because
it doesn't create a new scope where we need a copy of a mutable
reference, which of course is not allowed.

(cherry picked from commit a2acc93d13991da4b14a99065acd589477334d07)
2025-10-04 02:31:16 +02:00
Robert Hensing
2f3a5fb039 refact: Clean up Context interface to be safer
The mutation-based methods had some pitfalls, and we don't really
need them.

We could re-add them if we need to.

(cherry picked from commit ca92b8491d87cebf54dd2468599168fc7a16c07f)
2025-10-04 02:31:16 +02:00
Robert Hensing
c16a9b0595 refact: Make require_attrs_select* error handling regular
(cherry picked from commit de6c6cbd462202405bc787fed02dee249cf16973)
2025-10-04 02:31:16 +02:00
Robert Hensing
61efb9b79f refact: Add Context::check_one_call(f)
This makes it easier to stick to a regular pattern and not forget
to check the context afterwards.

(cherry picked from commit 966ef3769a23075f5d660a48cf5a7307df925dbf)
2025-10-04 02:31:16 +02:00
Robert Hensing
d38cf51c63 feat: Context.is_key_error
(cherry picked from commit f754e243852103164dbc6fdaf8c0cccb3c85cfb1)
2025-10-04 02:30:46 +02:00
Taeer Bar-Yam
48af0f9e41 error checking tweaks
(cherry picked from commit 6ac38519b710e69a0c30eb0fe8fc5fa712168cb8)
2025-10-04 02:30:46 +02:00
Taeer Bar-Yam
c2159c8834 bindgen strip nix_ prefix
(cherry picked from commit d07ec1990015f5d12b39da40ad0cb1ef0e798642)
2025-10-04 02:30:46 +02:00
Robert Hensing
7ef434a6d7 feat: Add nix-util crate with Context wrapper
(cherry picked from commit 6c8e116e8bbaecce2b77fd9e0db89f366b57f9b6)
2025-09-30 18:40:07 +02:00