Skip to content

Commit 8709ac8

Browse files
authored
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. 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.
2 parents dc90573 + caab16f commit 8709ac8

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

src/doc/unstable-book/src/language-features/const-fn.md

+2-21
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,5 @@ The tracking issue for this feature is: [#57563]
66

77
------------------------
88

9-
The `const_fn` feature allows marking free functions and inherent methods as
10-
`const`, enabling them to be called in constants contexts, with constant
11-
arguments.
12-
13-
## Examples
14-
15-
```rust
16-
#![feature(const_fn)]
17-
18-
const fn double(x: i32) -> i32 {
19-
x * 2
20-
}
21-
22-
const FIVE: i32 = 5;
23-
const TEN: i32 = double(FIVE);
24-
25-
fn main() {
26-
assert_eq!(5, FIVE);
27-
assert_eq!(10, TEN);
28-
}
29-
```
9+
The `const_fn` feature enables additional functionality not stabilized in the
10+
[minimal subset of `const_fn`](https://github.com/rust-lang/rust/issues/53555)

0 commit comments

Comments
 (0)