{"action":"opened","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/41081","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/41081/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/41081/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/41081/events","html_url":"https://github.com/rust-lang/rust/issues/41081","id":219583072,"number":41081,"title":"Tuple issue","user":{"login":"wind2412","id":15351672,"avatar_url":"https://avatars2.githubusercontent.com/u/15351672?v=3","gravatar_id":"","url":"https://api.github.com/users/wind2412","html_url":"https://github.com/wind2412","followers_url":"https://api.github.com/users/wind2412/followers","following_url":"https://api.github.com/users/wind2412/following{/other_user}","gists_url":"https://api.github.com/users/wind2412/gists{/gist_id}","starred_url":"https://api.github.com/users/wind2412/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wind2412/subscriptions","organizations_url":"https://api.github.com/users/wind2412/orgs","repos_url":"https://api.github.com/users/wind2412/repos","events_url":"https://api.github.com/users/wind2412/events{/privacy}","received_events_url":"https://api.github.com/users/wind2412/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-04-05T13:30:13Z","updated_at":"2017-04-05T13:30:13Z","closed_at":null,"body":"I defined a tuple: `let tuple: ((u8, u32),(u8, u32)) = ((1, 45), (2, 100));`\r\nAnd I have a tool to look up its type: \r\n```\r\n#![feature(core_intrinsics)]\r\n\r\nfn type_of<T>(_: T) {\r\n\tprintln!(\"{}\", unsafe { std::intrinsics::type_name::<T>() });\r\n}\r\n//p.s. from stack overflow\r\n```\r\n\r\nSo I can get the type of the tuple: `type_of(tuple.0);` and it turns out to be `(u8, u32)`.Right.\r\nAccording to convention, I can use `tuple.0.0` to get the first `u8` value. Because `type_of(tuple.0)` is `(u8, u32)`. But when I use `tuple.0`, I get:\r\n\r\n```\r\nerror: unexpected token: `0.0`\r\n  --> test_tuple.rs:38:16\r\n   |\r\n38 | \ttype_of(tuple.0.0);\t\t\r\n   | \t              ^^^\r\n   |\r\nhelp: try parenthesizing the first index\r\n   | \ttype_of(tuple.(tuple.0).0);\t \r\n\r\nerror[E0061]: this function takes 1 parameter but 0 parameters were supplied\r\n  --> test_tuple.rs:38:2\r\n   |\r\n3  |   fn type_of<T>(_: T) {\r\n   |  _- starting here...\r\n4  | | \tprintln!(\"{}\", unsafe { std::intrinsics::type_name::<T>() });\r\n5  | | }\r\n   | |_- ...ending here: defined here\r\n...\r\n38 |   \ttype_of(tuple.0.0);\t\t\r\n   |    ^^^^^^^^^^^^^^^^^^ expected 1 parameter\r\n\r\nerror: aborting due to previous error\r\n\r\n```\r\n\r\nA little weird of this wrong message... It tells us Rust recognized it as `tuple.(0.0)`...\r\nAnd I do as the \"help\"'s advice, `type_of(tuple.(tuple.0).3)` and then get another wrong msg...\r\n\r\n```\r\nerror: unexpected token: `(`\r\n  --> test_tuple.rs:39:16\r\n   |\r\n39 | \ttype_of(tuple.(tuple.0).3);\t\t\r\n   | \t              ^\r\n\r\nerror: aborting due to 2 previous errors\r\n```\r\n\r\nBut I use `(tuple.0).0` is okay...\r\n\r\nHope you can fix this syntax instead of `(tuple.0).0` and make the help message better~;)"}}
{"actor":{"display_login":"wind2412"}}