diff options
| author | lcnr <rust@lcnr.de> | 2021-09-20 19:10:40 +0200 |
|---|---|---|
| committer | Joshua Nelson <github@jyn.dev> | 2021-09-20 12:35:16 -0500 |
| commit | 8f60378e3656ed742d3d1bf5f763c43183be9339 (patch) | |
| tree | b9e9d5e5ab313a15eb90d0b96b23efe9250c0a5f /src/doc/rustc-dev-guide | |
| parent | 562ab2f037844d901dea89afd629d07fe9cb7551 (diff) | |
| download | rust-8f60378e3656ed742d3d1bf5f763c43183be9339.tar.gz rust-8f60378e3656ed742d3d1bf5f763c43183be9339.zip | |
const generics update
Diffstat (limited to 'src/doc/rustc-dev-guide')
| -rw-r--r-- | src/doc/rustc-dev-guide/src/SUMMARY.md | 1 | ||||
| -rw-r--r-- | src/doc/rustc-dev-guide/src/constants.md | 8 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/doc/rustc-dev-guide/src/SUMMARY.md b/src/doc/rustc-dev-guide/src/SUMMARY.md index c69ad73a547..5e59cf651c6 100644 --- a/src/doc/rustc-dev-guide/src/SUMMARY.md +++ b/src/doc/rustc-dev-guide/src/SUMMARY.md @@ -98,6 +98,7 @@ - [Generics and substitutions](./generics.md) - [`TypeFolder` and `TypeFoldable`](./ty-fold.md) - [Generic arguments](./generic_arguments.md) + - [Constants in the type system](./constants.md) - [Type inference](./type-inference.md) - [Trait solving](./traits/resolution.md) - [Early and Late Bound Parameters](./early-late-bound.md) diff --git a/src/doc/rustc-dev-guide/src/constants.md b/src/doc/rustc-dev-guide/src/constants.md index 9e63a58cde7..137351c22f8 100644 --- a/src/doc/rustc-dev-guide/src/constants.md +++ b/src/doc/rustc-dev-guide/src/constants.md @@ -7,20 +7,20 @@ with the two *additional* variants being `ConstKind::Value` and `ConstKind::Unev ## Unevaluated constants -*This section talks about what's happening with `feature(const_generics)` enabled. +*This section talks about what's happening with `feature(generic_const_exprs)` enabled. On stable we do not yet supply any generic parameters to anonymous constants, avoiding most of the issues mentioned here.* Unless a constant is either a simple literal, e.g. `[u8; 3]` or `foo::<{ 'c' }>()`, or a generic parameter, e.g. `[u8; N]`, converting a constant to its [`ty::Const`] representation -returns an unevaluated constant. Even fully concrete constants which do not depend on a -generic parameter are not evaluated right away. +returns an unevaluated constant. Even fully concrete constants which do not depend on +generic parameters are not evaluated right away. We do not eagerly evaluate constant as they can be used in the `where`-clauses of their parent item, for example: ```rust -#[feature(const_generics, const_evaluatable_checked)] +#[feature(generic_const_exprs)] fn foo<T: Trait>() where [u8; <T as Trait>::ASSOC + 1]: SomeOtherTrait, |
