-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.
Description
I tried this code:
#![feature(const_fn)]
#![feature(const_let)]
struct S {
state: u32,
}
impl S {
const fn foo(&mut self, x: u32) {
self.state = x;
}
}
fn main() {}
And got
error[E0658]: statements in constant functions are unstable (see issue #48821)
--> src/main.rs:9:9
|
9 | self.state = x;
| ^^^^^^^^^^^^^^
|
= help: add #![feature(const_let)] to the crate attributes to enable
Similar to #51251
Meta
rustc --version --verbose
:
rustc 1.29.0-nightly (874dec25e 2018-07-21)
binary: rustc
commit-hash: 874dec25ed4c08d36f17d396b6872ca50313fc8e
commit-date: 2018-07-21
host: x86_64-unknown-linux-gnu
release: 1.29.0-nightly
LLVM version: 7.0
Metadata
Metadata
Assignees
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.