Skip to content

match expression falling through? #26251

Closed
@jrvidal

Description

@jrvidal

I tried this code:

fn main() {
    let x = 'a';

    match x {
            'a'...'b' if false => {
                println!("one");
            },

            'a' => {
                println!("two");
            },

            'a'...'b' => {
                println!("three");
            },

            _ => panic!("what?")
    }
}

I expected to get two but I get three. Is this the expected semantics?

Meta

rustc --version --verbose:

rustc 1.1.0-beta (cd7d89a 2015-05-16) (built 2015-05-16)
binary: rustc
commit-hash: cd7d89a
commit-date: 2015-05-16
build-date: 2015-05-16
host: x86_64-unknown-linux-gnu
release: 1.1.0-beta

Metadata

Metadata

Assignees

Labels

A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions