Skip to content

Commit 0c59930

Browse files
committed
s/maybe/conditionally/
1 parent 290d7fe commit 0c59930

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

text/0000-const-trait-impls.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ fn compile_time_default<T: const Default>() -> T {
165165
}
166166
```
167167

168-
### Maybe-const trait bounds
168+
### Conditionally-const trait bounds
169169

170170
Many generic `const fn` and especially many const trait impls do not actually require a const trait impl for their generic parameters.
171171
As `const fn` can also be called at runtime, it would be too strict to require it to only be able to call things with const trait impls.
@@ -209,8 +209,8 @@ const fn default<T: ~const Default>() -> T {
209209
}
210210
```
211211

212-
`~const` is derived from "approximately", meaning "maybe" in this context, or specifically "const impl required if called in const context".
213-
It is the opposite of `?` (prexisting for `?Sized` bounds), which also means "maybe", but from the other direction: `?const` (not proposed here, see the alternatives section for why it was rejected) would mean "no const impl required, even if called in const context".
212+
`~const` is derived from "approximately", meaning "conditionally" in this context, or specifically "const impl required if called in const context".
213+
It is the opposite of `?` (prexisting for `?Sized` bounds), which also means "conditionally", but from the other direction: `?const` (not proposed here, see the alternatives section for why it was rejected) would mean "no const impl required, even if called in const context".
214214

215215
### `~const Destruct` trait
216216

@@ -288,13 +288,13 @@ A much more detailed explanation can be found in https://hackmd.io/@compiler-err
288288

289289
We generate a `ClauseKind::HostEffect` for every `const` or `~const` bound.
290290
To mirror how some effectful languages represent such effects,
291-
I'm going to use `<Type as Trait>::k#host` to allow setting whether the `host` effect is "const" (disabled) or "maybe" (generic).
291+
I'm going to use `<Type as Trait>::k#host` to allow setting whether the `host` effect is "const" (disabled) or "conditionally" (generic).
292292
This is not comparable with other associated bounds like type bounds or const bounds, as the values the associated host effect can
293293
take do neither have a usual hierarchy nor a concrete single value we can compare due to the following handling of those bounds:
294294

295295
* There is no "always" (enabled), as that is just the lack of a host effect, meaning no `<Type as Trait>::k#host` bound at all.
296296
* In contrast to other effect systems, we do not track the effect as a true generic parameter in the type system,
297-
but instead just ignore all `Maybe` bounds in host environments and treat them as `Const` in const environments.
297+
but instead just ignore all `Conditionally` bounds in host environments and treat them as `Const` in const environments.
298298

299299
While this could be modelled with generic parameters in the type system, that:
300300

@@ -340,7 +340,7 @@ desugars to
340340
const fn default<T>() -> T
341341
where
342342
T: Default,
343-
<T as Default>::k#host = Maybe,
343+
<T as Default>::k#host = Conditionally,
344344
{
345345
T::default()
346346
}
@@ -550,7 +550,7 @@ Note that it may frequently be that such a trait should have been split even wit
550550
# Alternatives
551551
[alternatives]: #alternatives
552552

553-
## use `const Trait` bounds for maybe-const, invent new syntax for always-const
553+
## use `const Trait` bounds for conditionally-const, invent new syntax for always-const
554554

555555
It may seem tempting to use `const fn foo<T: const Trait>` to mean what in this RFC is `~const Trait`, and then add new syntax for bounds that allow using trait methods in const blocks.
556556

0 commit comments

Comments
 (0)