]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0379.md
Rollup merge of #82691 - ehuss:update-books, r=ehuss
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0379.md
1 A trait method was declared const.
2
3 Erroneous code example:
4
5 ```compile_fail,E0379
6 #![feature(const_fn)]
7
8 trait Foo {
9     const fn bar() -> u32; // error!
10 }
11 ```
12
13 Trait methods cannot be declared `const` by design. For more information, see
14 [RFC 911].
15
16 [RFC 911]: https://github.com/rust-lang/rfcs/pull/911