Skip to content

const fn with _ as an arg name vomits #28822

Closed
@Gankra

Description

@Gankra

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, ...)E-easyCall 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.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions