GitHub PullRequestReviewCommentEvent at 2014-05-13 22:59:52
Repository: rust
Actor: Kimundi
Payload: {"comment":{"url":"https://api.github.com/repos/mozilla/rust/pulls/comments/12613697","id":12613697,"diff_hunk":"@@ -148,6 +148,33 @@ fn check_expr(v: &mut CheckCrateVisitor, e: &Expr, is_const: bool) {\n                 }\n             }\n           }\n+          ExprBlock(ref block) => {\n+            // Check all statements in the block\n+            for stmt in block.stmts.iter() {\n+                let block_span_err = |span|\n+                    v.tcx.sess.span_err(span,\n+                        \"blocks in constants are limited to \\\n+                        items and tail expressions\");\n+                match stmt.node {\n+                    StmtDecl(ref span, _) => {\n+                        match span.node {\n+                            DeclLocal(_) => block_span_err(span.span),\n+\n+                            // Item statements are allowed\n+                            DeclItem(_) => {}\n+                        }\n+                    }\n+                    StmtExpr(ref expr, _) => block_span_err(expr.span),\n+                    StmtSemi(ref semi, _) => block_span_err(semi.span),\n+                    StmtMac(..) => v.tcx.sess.span_bug(e.span,\n+                        \"unexpanded statement macro in const?!\")","path":"src/librustc/middle/check_const.rs","position":23,"original_position":23,"commit_id":"baa1a92d5b4edf2fe0fc5d43cd6b40e31fb372ad","original_commit_id":"538bb68e72a14220ffc5d50d5a55f8bd45f80d10","user":{"login":"Kimundi","id":2903206,"avatar_url":"https://avatars.githubusercontent.com/u/2903206?","gravatar_id":"f79d6dcfad6dfca49a28a19d76dfe323","url":"https://api.github.com/users/Kimundi","html_url":"https://github.com/Kimundi","followers_url":"https://api.github.com/users/Kimundi/followers","following_url":"https://api.github.com/users/Kimundi/following{/other_user}","gists_url":"https://api.github.com/users/Kimundi/gists{/gist_id}","starred_url":"https://api.github.com/users/Kimundi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kimundi/subscriptions","organizations_url":"https://api.github.com/users/Kimundi/orgs","repos_url":"https://api.github.com/users/Kimundi/repos","events_url":"https://api.github.com/users/Kimundi/events{/privacy}","received_events_url":"https://api.github.com/users/Kimundi/received_events","type":"User","site_admin":false},"body":"```\r\nstatic BLOCK_MACRO_RULES_EXPORTED: uint = {\r\n    #[macro_export]\r\n    macro_rules! baz {\r\n        () => (612)\r\n    }\r\n    baz!()\r\n};\r\n```\r\n\r\ngives me the error\r\n\r\n```\r\n\t/home/marvin/dev/rust/fork/rust/src/test/run-pass/const-block-item.rs:51:19: 51:20 error: expected item after attributes\r\n\t/home/marvin/dev/rust/fork/rust/src/test/run-pass/const-block-item.rs:51     #[macro_export]\r\n\t                                                                                           ^\r\n```\r\n\r\nAm I doing something wrong?","created_at":"2014-05-13T22:59:52Z","updated_at":"2014-05-13T22:59:52Z","html_url":"https://github.com/mozilla/rust/pull/14183#discussion_r12613697","pull_request_url":"https://api.github.com/repos/mozilla/rust/pulls/14183","_links":{"self":{"href":"https://api.github.com/repos/mozilla/rust/pulls/comments/12613697"},"html":{"href":"https://github.com/mozilla/rust/pull/14183#discussion_r12613697"},"pull_request":{"href":"https://api.github.com/repos/mozilla/rust/pulls/14183"}}}}