Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't mix generic and specific literals in match arms #16745

Closed
mahkoh opened this issue Aug 25, 2014 · 4 comments · Fixed by #24586
Closed

Can't mix generic and specific literals in match arms #16745

mahkoh opened this issue Aug 25, 2014 · 4 comments · Fixed by #24586
Labels
A-typesystem Area: The type system E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@mahkoh
Copy link
Contributor

mahkoh commented Aug 25, 2014

For example

n is_whitespace(b: u8) -> bool {
    match b {
        b' '  => true,
        b'\t' => true,
        b'\n' => true,
        0x0B  => true,
        0x0C  => true,
        b'\r' => true,
        _     => false,
    }
}
mod.rs:166:9: 166:13 error: mismatched types between arms
mod.rs:166         b' '  => true,
                   ^~~~
mod.rs:167:9: 167:14 error: mismatched types between arms
mod.rs:167         b'\t' => true,
                   ^~~~~
mod.rs:168:9: 168:14 error: mismatched types between arms
mod.rs:168         b'\n' => true,
                   ^~~~~
mod.rs:166:9: 166:13 error: mismatched types between arms
mod.rs:166         b' '  => true,
                   ^~~~
mod.rs:167:9: 167:14 error: mismatched types between arms
mod.rs:167         b'\t' => true,
                   ^~~~~
mod.rs:168:9: 168:14 error: mismatched types between arms
mod.rs:168         b'\n' => true,
                   ^~~~~
mod.rs:169:9: 169:13 error: mismatched types between arms
mod.rs:169         0x0B  => true,
                   ^~~~
mod.rs:170:9: 170:13 error: mismatched types between arms
mod.rs:170         0x0C  => true,
@ghost ghost self-assigned this Oct 14, 2014
@mahkoh
Copy link
Contributor Author

mahkoh commented Jan 5, 2015

fn main() {
    const X: u8 = 0;
    match 0u8 {
        X => { },
        1u8 => { },
        _ => { }
    }
}

@steveklabnik steveklabnik added the A-typesystem Area: The type system label Jan 29, 2015
@mahkoh mahkoh closed this as completed Apr 6, 2015
@ghost ghost reopened this Apr 16, 2015
@pnkfelix
Copy link
Member

@jakub- this actually appears to be currently fixed to me; I don't doubt that your PR has value, but can you explain which of the cases reported on this ticket is currently failing for you?

@ghost
Copy link

ghost commented Apr 19, 2015

@pnkfelix Ah, I hadn't actually checked if this issue was still valid! But it seems you're right and I don't think my PR is even relevant after the recent changes to constant evaluation. Closing, thanks.

@ghost ghost closed this as completed Apr 19, 2015
@ghost
Copy link

ghost commented Apr 19, 2015

Well, sorry, FWIW, this A-needstest.

@ghost ghost reopened this Apr 19, 2015
@ghost ghost added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Apr 19, 2015
richo added a commit to richo/rust that referenced this issue Apr 19, 2015
richo added a commit to richo/rust that referenced this issue Apr 19, 2015
bors added a commit that referenced this issue Apr 20, 2015
matthiaskrgr pushed a commit to matthiaskrgr/rust that referenced this issue Mar 10, 2024
…ing, r=Veykril

fix: Don't escape `\` and `$` in "Extract format expressions" assist

Fixes rust-lang#16745
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-typesystem Area: The type system E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants