• 0v0@sopuli.xyz
    link
    fedilink
    arrow-up
    10
    ·
    5 months ago

    It’s because it has to work in pattern contexts as well, which are not expressions.

    • SorteKaninOPA
      link
      fedilink
      arrow-up
      2
      ·
      5 months ago

      Wait, in pattern context? How? Can you give an example?

      • 0v0@sopuli.xyz
        link
        fedilink
        arrow-up
        10
        ·
        5 months ago
        fn foo(x: i32) {
            match x {
                const { 3.pow(3) } => println!("three cubed"),
                _ => {}
            }
        }
        

        But it looks like inline_const_pat is still unstable, only inline_const in expression position is now stabilized.