deprecated-features/ancient-let: Upgrade to hard error

Change-Id: Ib856a665a8175a880b3ff52dde9d34769f24713b
This commit is contained in:
piegames
2026-01-31 21:58:33 +01:00
parent adfbc836c0
commit c76632e17d
5 changed files with 16 additions and 9 deletions
@@ -16,3 +16,4 @@ You can opt in into the old behavior with `--extra-deprecated-features` or any e
- `or-as-identifier` `or` as an identifier has always been weird since the `or` (almost-)keyword has been introduced. We are deprecating the backcompat hacks from the early days of Nix in favor of making `or` a full and proper keyword.
- `tokens-no-whitespace` Function applications without space around the arguments like `0a`, `0.00.0` or `foo"1"2` are now forbidden. The same applies to list elements. The primary reason for this deprecation is to remove foot guns around surprising tokenization rules regarding number literals, but this will also free up some syntax for other purposes (e.g. `r""` strings) for reuse at some point in the future.
- `shadow-internal-symbols` has been expanded to also forbid shadowing `null`, `true` and `false`.
- `ancient-let` deprecation has been turned into a full parser error instead of a warning.
+9 -9
View File
@@ -913,18 +913,18 @@ template<> struct BuildAST<grammar::v1::expr::uri> {
template<> struct BuildAST<grammar::v1::expr::ancient_let> : change_head<BindingsStateRecSet> {
static void success(const auto & in, BindingsStateRecSet & b, ExprState & s, State & ps) {
// Added 2024-09-18. Turn into an error at some point in the future.
// Added 2024-09-18 as a warning, turned into error 2026-01-29.
// See the documentation on deprecated features for more details.
if (!ps.featureSettings.isEnabled(Dep::AncientLet))
//FIXME: why aren't there any tests for this?
logWarning({
.msg = HintFmt(
"%s is deprecated and will be removed in the future. Use %s to silence this warning.",
"let {",
"--extra-deprecated-features ancient-let"
),
.pos = ps.positions[ps.at(in)]
});
throw ParseError(
{.msg = HintFmt(
"%s is deprecated and will be removed in the future. Use %s to silence this warning.",
"let {",
"--extra-deprecated-features ancient-let"
),
.pos = ps.positions[ps.at(in)]}
);
auto pos = ps.at(in);
b.set.pos = pos;
@@ -6,6 +6,10 @@ timeline:
release: 2.92.0
cls: [1787]
message: Introduced as soft deprecation with a warning.
- date: 2026-01-29
release: 2.95.0
cls: [5039]
message: Upgraded the warning to a parse error.
---
The ancient `let { body = …; … }` syntax is deprecated.
+1
View File
@@ -17,6 +17,7 @@ let
"rec-set-dynamic-attrs"
"or-as-identifier"
"tokens-no-whitespace"
"ancient-let"
];
in
+1
View File
@@ -26,6 +26,7 @@ let
"rec-set-dynamic-attrs"
"or-as-identifier"
"tokens-no-whitespace"
"ancient-let"
];
env.NIX_CONFIG = "extra-deprecated-features = ${concatStringsSep " " deprecatedFeatures}";