From 34b17dd311e41d24273d76f350f7d825aa8a6c3a Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Wed, 29 Oct 2025 12:59:44 +0200 Subject: [PATCH 1/4] const_eval.md: add missing word --- src/const_eval.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/const_eval.md b/src/const_eval.md index 71f392dc3f..8c6bd00ef5 100644 --- a/src/const_eval.md +++ b/src/const_eval.md @@ -15,7 +15,7 @@ compile time. r[const-eval.const-expr.const-context] In [const contexts](#const-context), these are the only allowed -expressions, and are always evaluated at compile time. +expressions, and they are always evaluated at compile time. r[const-eval.const-expr.runtime-context] In other places, such as [let statements], constant expressions *may* be, but are not guaranteed to be, evaluated at compile time. From e2366196812fecedfbdd97d93eed3449c3fb0ae7 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Wed, 29 Oct 2025 13:00:42 +0200 Subject: [PATCH 2/4] unwrap --- src/const_eval.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/const_eval.md b/src/const_eval.md index 8c6bd00ef5..efb07e2c1d 100644 --- a/src/const_eval.md +++ b/src/const_eval.md @@ -14,8 +14,7 @@ Certain forms of expressions, called constant expressions, can be evaluated at compile time. r[const-eval.const-expr.const-context] -In [const contexts](#const-context), these are the only allowed -expressions, and they are always evaluated at compile time. +In [const contexts](#const-context), these are the only allowed expressions, and they are always evaluated at compile time. r[const-eval.const-expr.runtime-context] In other places, such as [let statements], constant expressions *may* be, but are not guaranteed to be, evaluated at compile time. From 5db0af7b9493a3fcc23c4e77fc7b3781ed3d98c1 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Tue, 16 Dec 2025 21:29:04 +0000 Subject: [PATCH 3/4] Revise const context rules Let's break this out into two rules and reword. Co-authored-by: Eric Huss --- src/const_eval.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/const_eval.md b/src/const_eval.md index efb07e2c1d..a0c8a8d0f1 100644 --- a/src/const_eval.md +++ b/src/const_eval.md @@ -14,7 +14,10 @@ Certain forms of expressions, called constant expressions, can be evaluated at compile time. r[const-eval.const-expr.const-context] -In [const contexts](#const-context), these are the only allowed expressions, and they are always evaluated at compile time. +Expressions in a [const context] must be constant expressions. + +r[const-eval.const-expr.evaluation] +Expressions in const contexts are always evaluated at compile time. r[const-eval.const-expr.runtime-context] In other places, such as [let statements], constant expressions *may* be, but are not guaranteed to be, evaluated at compile time. From 666907b28581f9e17c6661eb2dc6349d388d4919 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Tue, 16 Dec 2025 21:39:41 +0000 Subject: [PATCH 4/4] Revise following sentence about eval outside of const The changes to the sentence before this one make the lack of clarity of this sentence stand out more, so let's improve the clarity of this sentence about evaluation of constant expressions outside of a const context. --- src/const_eval.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/const_eval.md b/src/const_eval.md index a0c8a8d0f1..89b50f12bb 100644 --- a/src/const_eval.md +++ b/src/const_eval.md @@ -20,7 +20,7 @@ r[const-eval.const-expr.evaluation] Expressions in const contexts are always evaluated at compile time. r[const-eval.const-expr.runtime-context] -In other places, such as [let statements], constant expressions *may* be, but are not guaranteed to be, evaluated at compile time. +Outside of const contexts, constant expressions *may* be, but are not guaranteed to be, evaluated at compile time. r[const-eval.const-expr.error] Behaviors such as out of bounds [array indexing] or [overflow] are compiler errors if the value