Allow parenthesis around inferred array lengths
This commit is contained in:
parent
69b3959afe
commit
8f00b1fdad
3 changed files with 75 additions and 2 deletions
|
@ -2034,7 +2034,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||
}
|
||||
|
||||
fn lower_array_length_to_const_arg(&mut self, c: &AnonConst) -> &'hir hir::ConstArg<'hir> {
|
||||
match c.value.kind {
|
||||
// We cannot just match on `ExprKind::Underscore` as `(_)` is represented as
|
||||
// `ExprKind::Paren(ExprKind::Underscore)` and should also be lowered to `GenericArg::Infer`
|
||||
match c.value.peel_parens().kind {
|
||||
ExprKind::Underscore => {
|
||||
if !self.tcx.features().generic_arg_infer() {
|
||||
feature_err(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue