Skip to content

Improve associated constant item CTFE timing section #1147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 8, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/items/associated-items.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,8 @@ type that the definition has to implement.
An *associated constant definition* defines a constant associated with a
type. It is written the same as a [constant item].

Unlike [free] constants, associated constant definitions undergo
[constant evaluation] only when referenced.
Associated constant definitions undergo [constant evaluation] only when
referenced.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And only after monomorphization. Nothing is actually done on generic constants, even if we could attempt it nowadays

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed d0b33a2 and 37e3c15 to try to explain this.


```rust
struct Struct;
Expand Down Expand Up @@ -381,5 +381,4 @@ fn main() {
[regular function parameters]: functions.md#attributes-on-function-parameters
[generic parameters]: generics.md
[where clauses]: generics.md#where-clauses
[free]: ../glossary.md#free-item
[constant evaluation]: ../const_eval.md