Skip to content

feat(box_patterns) not recognized #19

@matthiaskrgr

Description

@matthiaskrgr

The following code

#![allow(unused_mut)]
#![allow(unused_variables)]

#![feature(box_patterns)]

enum E {
    StructVar { boxed: Box<i32> }
}

fn main() {

    let mut a = E::StructVar { boxed: Box::new(3) };
    match a {
        E::StructVar { box boxed } => { }
    }
    match a {
        E::StructVar { box ref boxed } => { }
    }
    match a {
        E::StructVar { box mut boxed } => { }
    }
    match a {
        E::StructVar { box ref mut boxed } => { }
    }
    match a {
        E::StructVar { ref boxed } => { }
    }
    match a {
        E::StructVar { ref mut boxed } => { }
    }
    match a {
        E::StructVar { mut boxed } => { }
    }

    let mut a = E::StructVar { boxed: Box::new(3) };
    match a {
        E::StructVar { boxed: box ref mut num } => { }
    }
    match a {
        E::StructVar { boxed: ref mut num } => { }
    }

}

Compiled successfully ( with --crate-type=lib --cap-lints=warn ):

warning: enum `E` is never used
 --> ./2025_12_29__16_06_56/ad370509e6785e96991806fb7d707148578492c2.rs:6:6
  |
6 | enum E {
  |      ^
  |
  = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default

warning: function `main` is never used
  --> ./2025_12_29__16_06_56/ad370509e6785e96991806fb7d707148578492c2.rs:10:4
   |
10 | fn main() {
   |    ^^^^

warning: 2 warnings emitted


However rasur was found to have errors (-e 2015):

error: found `box` but expected common identifier or number literal
  --> ./2025_12_29__16_06_56/ad370509e6785e96991806fb7d707148578492c2.rs:14:24
   |
14 |         E::StructVar { box boxed } => { }
   |                        ^^^ unexpected token

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions