1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-01 06:31:00 +01:00

Add position info to path values

(Actually, this adds a position field to *all* values.)

This allows improving the "inefficient double copy" warning by showing
where the source path came from in the source, e.g.

  warning: Performing inefficient double copy of path '/home/eelco/Dev/patchelf/' to the store at /home/eelco/Dev/patchelf/flake.nix:30:17. This can typically be avoided by rewriting an attribute like `src = ./.` to `src = builtins.path { path = ./.; name = "source"; }`.
This commit is contained in:
Eelco Dolstra 2025-05-30 17:31:34 +02:00
parent 8ff43c29ef
commit 3e45b40d66
9 changed files with 33 additions and 20 deletions

View file

@ -15,12 +15,12 @@ class PosIdx
private:
uint32_t id;
public:
explicit PosIdx(uint32_t id)
: id(id)
{
}
public:
PosIdx()
: id(0)
{
@ -45,6 +45,11 @@ public:
{
return std::hash<uint32_t>{}(id);
}
uint32_t get() const
{
return id;
}
};
inline PosIdx noPos = {};