Rollup merge of #79858 - sasurau4:doc/update-unstable-book-const-fn, r=oli-obk

Update const-fn doc in unstable-book

Fix #79691

I couldn't find suitable examples. It seems that `const_fn` feature-gate used only following place. 810324d1f3/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.
This commit is contained in:
Tyler Mandry 2020-12-10 21:33:12 -08:00 committed by GitHub
commit 8709ac81d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 21 deletions

View File

@ -6,24 +6,5 @@ The tracking issue for this feature is: [#57563]
------------------------
The `const_fn` feature allows marking free functions and inherent methods as
`const`, enabling them to be called in constants contexts, with constant
arguments.
## Examples
```rust
#![feature(const_fn)]
const fn double(x: i32) -> i32 {
x * 2
}
const FIVE: i32 = 5;
const TEN: i32 = double(FIVE);
fn main() {
assert_eq!(5, FIVE);
assert_eq!(10, TEN);
}
```
The `const_fn` feature enables additional functionality not stabilized in the
[minimal subset of `const_fn`](https://github.com/rust-lang/rust/issues/53555)