{"action":"closed","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/28687","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/28687/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/28687/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/28687/events","html_url":"https://github.com/rust-lang/rust/issues/28687","id":108523789,"number":28687,"title":"Rules for matching against variable unclear.","user":{"login":"Aaronepower","id":4464295,"avatar_url":"https://avatars.githubusercontent.com/u/4464295?v=3","gravatar_id":"","url":"https://api.github.com/users/Aaronepower","html_url":"https://github.com/Aaronepower","followers_url":"https://api.github.com/users/Aaronepower/followers","following_url":"https://api.github.com/users/Aaronepower/following{/other_user}","gists_url":"https://api.github.com/users/Aaronepower/gists{/gist_id}","starred_url":"https://api.github.com/users/Aaronepower/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aaronepower/subscriptions","organizations_url":"https://api.github.com/users/Aaronepower/orgs","repos_url":"https://api.github.com/users/Aaronepower/repos","events_url":"https://api.github.com/users/Aaronepower/events{/privacy}","received_events_url":"https://api.github.com/users/Aaronepower/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang/rust/labels/A-docs","name":"A-docs","color":"d7e102"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-27T09:06:47Z","updated_at":"2015-10-08T20:53:27Z","closed_at":"2015-10-08T20:53:27Z","body":"When you have a match statement against a variable the behaviour is unexpected.\r\n\r\n[I tried this code:](http://is.gd/7AZ2lx)\r\n```\r\nfn main() {\r\n    let x = 'x';\r\n    let c = 'c';\r\n    match c {\r\n        x => println!(\"Bug? {} {}\", x, c),\r\n    }\r\n    \r\n    println!(\"x: {}\", x)\r\n}\r\n```\r\n\r\n#### I expected to to see this happen:\r\n\r\nEither get an error telling me that placing a variable won't do what I think it will do. Or allow this to happen, and allow for specific cases, as currently adding any extra arms returns a `unreachable pattern` error.\r\n\r\n#### Instead this happened:\r\n\r\nThis compiles with no errors, or warning, and prints out:\r\n```\r\nBug? c c\r\nx: x\r\n```\r\n\r\n## Meta\r\n\r\n`rustc --version --verbose`\r\n\r\n```\r\nrustc 1.3.0 (9a92aaf19 2015-09-15)\r\nbinary: rustc\r\ncommit-hash: 9a92aaf19a64603b02b4130fe52958cc12488900\r\ncommit-date: 2015-09-15\r\nhost: x86_64-apple-darwin\r\nrelease: 1.3.0\r\n```"}}