Skip to content

Commit 5554636

Browse files
committed
Whitelisting PatWild for E0022. Fix #28822
1 parent 7dcc4d7 commit 5554636

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/librustc/middle/check_const.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> {
177177
for arg in &fd.inputs {
178178
match arg.pat.node {
179179
hir::PatIdent(hir::BindByValue(hir::MutImmutable), _, None) => {}
180+
hir::PatWild(_) => {}
180181
_ => {
181182
span_err!(self.tcx.sess, arg.pat.span, E0022,
182183
"arguments of constant functions can only \

src/test/run-pass/issue-28822.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![feature(const_fn)]
12+
13+
fn main() {}
14+
15+
const fn size_ofs(_: usize) {}
16+
const fn size_ofs2(_foo: usize) {}

0 commit comments

Comments
 (0)