]> git.lizzy.rs Git - rust.git/blob - src/librustc_error_codes/error_codes/E0723.md
Rollup merge of #64856 - jonhoo:format-temporaries, r=sfackler
[rust.git] / src / librustc_error_codes / error_codes / E0723.md
1 An feature unstable in `const` contexts was used.
2
3 Erroneous code example:
4
5 ```compile_fail,E0723
6 trait T {}
7
8 impl T for () {}
9
10 const fn foo() -> impl T { // error: `impl Trait` in const fn is unstable
11     ()
12 }
13 ```
14
15 To enable this feature on a nightly version of rustc, add the `const_fn`
16 feature flag:
17
18 ```
19 #![feature(const_fn)]
20
21 trait T {}
22
23 impl T for () {}
24
25 const fn foo() -> impl T {
26     ()
27 }
28 ```