You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`~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".
214
214
215
215
### `~const Destruct` trait
216
216
@@ -288,13 +288,13 @@ A much more detailed explanation can be found in https://hackmd.io/@compiler-err
288
288
289
289
We generate a `ClauseKind::HostEffect` for every `const` or `~const` bound.
290
290
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).
292
292
This is not comparable with other associated bounds like type bounds or const bounds, as the values the associated host effect can
293
293
take do neither have a usual hierarchy nor a concrete single value we can compare due to the following handling of those bounds:
294
294
295
295
* 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.
296
296
* 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.
298
298
299
299
While this could be modelled with generic parameters in the type system, that:
300
300
@@ -340,7 +340,7 @@ desugars to
340
340
constfndefault<T>() ->T
341
341
where
342
342
T:Default,
343
-
<TasDefault>::k#host=Maybe,
343
+
<TasDefault>::k#host=Conditionally,
344
344
{
345
345
T::default()
346
346
}
@@ -550,7 +550,7 @@ Note that it may frequently be that such a trait should have been split even wit
550
550
# Alternatives
551
551
[alternatives]: #alternatives
552
552
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
554
554
555
555
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.
0 commit comments