Skip to content

Conversation

@xokdvium
Copy link
Contributor

@xokdvium xokdvium commented Sep 1, 2025

Motivation

In b70d22b mkStringNoCopy() was renamed to
mkString(), but this is a bit risky since in code like

vStringRegular.mkString("regular");

we want to be sure that the right overload is picked. (This is
especially problematic since the overload that takes an
std::string_view does allocate.) So let's be explicit.

(Rebased from #11551)

Context

The first commit is rebased from #11551, the other one is makes prim_typeOf not copy string literals.


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

edolstra and others added 2 commits September 2, 2025 00:16
In b70d22b `mkStringNoCopy()` was renamed to
`mkString()`, but this is a bit risky since in code like

    vStringRegular.mkString("regular");

we want to be sure that the right overload is picked. (This is
especially problematic since the overload that takes an
`std::string_view` *does* allocate.)  So let's be explicit.

(Rebased from NixOS#11551)
This would lead to an unnecessary allocation. Not
a significant issue by any means, but it doesn't
have to allocate for most cases.
@github-actions github-actions bot added the new-cli Relating to the "nix" command label Sep 1, 2025
@xokdvium xokdvium merged commit 1935c19 into NixOS:master Sep 2, 2025
14 checks passed
@xokdvium xokdvium deleted the mkstring-no-copy branch September 2, 2025 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-cli Relating to the "nix" command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants