Skip to content

else can be used without if #23

@hellow554

Description

@hellow554

TIL: https://lukaslueg.github.io/macro_railroad_wasm_demo

It clearly shows that an else can be used solely without a leading `if.
A quick jump into the compiler shows it as well:

use cfg_if::cfg_if;

fn main() { 
    cfg_if! {
        else {
            fn a() {
                println!("Foo");
            }
        }
    }
    a();
}

Is this intended? If yes, it should be documented, if not, it should be prohibited.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions