Skip to content

Update Unstable Book docs for const_fn #79691

New issue

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

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

Already on GitHub? # to your account

Closed
camelid opened this issue Dec 4, 2020 · 1 comment · Fixed by #79858
Closed

Update Unstable Book docs for const_fn #79691

camelid opened this issue Dec 4, 2020 · 1 comment · Fixed by #79858
Assignees
Labels
A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@camelid
Copy link
Member

camelid commented Dec 4, 2020

The docs currently say:

The const_fn feature allows marking free functions and inherent methods as const, enabling them to be called in constants contexts, with constant arguments.

But that part of const_fn is already stable: #![feature(const_fn)] enables additional functionality.

cc #79674 (comment)

@camelid camelid added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. A-const-fn A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools labels Dec 4, 2020
@sasurau4
Copy link
Contributor

sasurau4 commented Dec 8, 2020

I'll work on this.
@rustbot claim

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Dec 10, 2020
…onst-fn, r=oli-obk

Update const-fn doc in unstable-book

Fix rust-lang#79691

I couldn't find suitable examples. It seems that `const_fn` feature-gate used only following place. https://github.com/rust-lang/rust/blob/810324d1f31eb8d75e8f0044df720652986ef133/compiler/rustc_ast_passes/src/feature_gate.rs#L560-L562

And example like following emits [E0379](https://doc.rust-lang.org/error-index.html#E0379).

```rust
#![feature(const_fn)]

trait Foo {
    const fn bar() -> Self;
}
```

Any other suitable example exists, please let me know.
@bors bors closed this as completed in 8709ac8 Dec 11, 2020
@RalfJung RalfJung added the A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) label Dec 1, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants