Skip to content

Pattern matching on unsafe pointers doesn't work #7010

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

Closed
brson opened this issue Jun 8, 2013 · 3 comments
Closed

Pattern matching on unsafe pointers doesn't work #7010

brson opened this issue Jun 8, 2013 · 3 comments
Labels
A-codegen Area: Code generation A-parser Area: The lexing & parsing of Rust source code to an AST

Comments

@brson
Copy link
Contributor

brson commented Jun 8, 2013

I've wanted it at least once.

@emberian
Copy link
Member

emberian commented Aug 5, 2013

@brson what do you envision for "working"? For example, the following compiles and runs:

fn main() {
    let x = 4096 as *u8;
    match x {
        _ => fail!("foo")
    }
}

@sanxiyn
Copy link
Member

sanxiyn commented Jan 3, 2014

Triage. I suspect this refers to match pointer { *value => ... }. You can match values of type &T with pattern &pat, but can't match values of type *T with pattern *pat at the moment. Indeed, *pat is an invalid pattern syntax now.

@steveklabnik
Copy link
Member

I'm pulling a massive triage effort to get us ready for 1.0. As part of this, I'm moving stuff that's wishlist-like to the RFCs repo, as that's where major new things should get discussed/prioritized.

This issue has been moved to the RFCs repo: rust-lang/rfcs#641

flip1995 pushed a commit to flip1995/rust that referenced this issue Apr 8, 2021
Internal `if_chain!` lints

changelog: none

We use `if_chain!` a lot. So this enforces some style rules around it, internal only.

Lints when...
* Nested `if`/`if_chain!` can be collapsed
* An `if_chain!` starts with `let` or ends with `let ..; then {..}`
* An `if_chain!` has only one `if`
* An `if_chain!` contains `if .. && ..;` that spans multiple lines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation A-parser Area: The lexing & parsing of Rust source code to an AST
Projects
None yet
Development

No branches or pull requests

4 participants