-
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, ...)E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
Description
Doesn't work:
#![feature(const_fn)]
fn main(){}
const fn size_ofs(_: usize) { }
<anon>:3:19: 3:20 error: arguments of constant functions can only be immutable by-value bindings [E0022]
<anon>:3 const fn size_ofs(_: usize) { }
^
<anon>:3:19: 3:20 help: see the detailed explanation for E0022
error: aborting due to previous error
playpen: application terminated with error code 101
Works:
#![feature(const_fn)]
fn main(){}
const fn size_ofs(_foo: usize) { }
<anon>:3:1: 3:35 warning: function is never used: `size_ofs`, #[warn(dead_code)] on by default
<anon>:3 const fn size_ofs(_foo: usize) { }
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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, ...)E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.