diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2015-01-22 17:46:40 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2015-01-30 10:37:44 -0500 |
| commit | 76362f0a0ee1b66d7df524c4c8dea9b15b45cf78 (patch) | |
| tree | db45562431cfa6109a45a0e13f98b70252e2bb42 /src/libsyntax | |
| parent | 5e1820f34611e311759518440fd4129c5f0c322a (diff) | |
| download | rust-76362f0a0ee1b66d7df524c4c8dea9b15b45cf78.tar.gz rust-76362f0a0ee1b66d7df524c4c8dea9b15b45cf78.zip | |
custom message for refutable patterns in for loops
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 1 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 11068880b0e..d7283db25a5 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -788,6 +788,7 @@ pub enum MatchSource { Normal, IfLetDesugar { contains_else_clause: bool }, WhileLetDesugar, + ForLoopDesugar, } #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 357bd2c17ab..5736400313e 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -288,8 +288,8 @@ pub fn expand_expr(e: P<ast::Expr>, fld: &mut MacroExpander) -> P<ast::Expr> { fld.cx.expr_call(span, fld.cx.expr_path(next_path), vec![ref_mut_iter]); let arms = vec![pat_arm, break_arm]; - // FIXME(japaric) This should use `ForLoopDesugar` as MatchSource - fld.cx.expr_match(pat_span, next_expr, arms) + fld.cx.expr(pat_span, + ast::ExprMatch(next_expr, arms, ast::MatchSource::ForLoopDesugar)) }; // `[opt_ident]: loop { ... }` |
