Skip to content
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

Add const generic default restrictions #1159

Open
ehuss opened this issue Feb 8, 2022 · 0 comments
Open

Add const generic default restrictions #1159

ehuss opened this issue Feb 8, 2022 · 0 comments

Comments

@ehuss
Copy link
Contributor

ehuss commented Feb 8, 2022

With const generic defaults stabilized (#90207), the reference should talk more about what the restrictions are.

  • What are valid expressions for the default? I assume it has to be a constant expression, are there other restrictions?
  • Presumably this is a const context, so I think "default const parameters" should be added to that list.
  • Restrictions on the type of the default expression. I believe it must be the same type as the declaration, but can there be any coercion?
  • Const defaults are only allowed on struct/enum/type/trait, but not fn or …

Are there other details about const generic defaults that can be added?
Note: default generic parameters are not documented at all. That is a separate issue (#24). That would also be great to complete, but I think can be done somewhat separately of this issue.

See also stabilization report: rust-lang/rust#90207 (comment)
and #1098.

@ehuss ehuss changed the title Add const generate default restrictions Add const generic default restrictions Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant