diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2015-07-22 23:23:36 +0200 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2015-07-22 23:23:36 +0200 |
| commit | abad7d6bba9d3fa9d5f1126c8ef6f1b413db1152 (patch) | |
| tree | 4fe8116a02df05b5042aa9f1b9e00dd680e5cd40 /src/libsyntax/parse | |
| parent | 505cd8a3cc9ddc89ff766a07cc90797421296d34 (diff) | |
| download | rust-abad7d6bba9d3fa9d5f1126c8ef6f1b413db1152.tar.gz rust-abad7d6bba9d3fa9d5f1126c8ef6f1b413db1152.zip | |
placate `make tidy`.
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 6c10d6efa50..c229ac31fc0 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2638,7 +2638,7 @@ impl<'a> Parser<'a> { // ... but for now: check for a place: `box(PLACE) EXPR`. if try!(self.eat(&token::OpenDelim(token::Paren)) ){ - // SNAP ba0e1cd + // SNAP d4432b3 // Enable this warning after snapshot ... // // let box_span = mk_sp(lo, self.last_span.hi); @@ -2659,9 +2659,15 @@ impl<'a> Parser<'a> { self.span_err(span, &format!("expected expression, found `{}`", this_token_to_string)); + + // Spanning just keyword avoids constructing + // printout of arg expression (which starts + // with parenthesis, as established above). + let box_span = mk_sp(lo, keyword_hi); - let new_expr = format!("box () {}", pprust::expr_to_string(&place)); - self.span_suggestion(box_span, "try using `box ()` instead:", new_expr); + self.span_suggestion(box_span, + "try using `box ()` instead:", + format!("box ()")); self.abort_if_errors(); } let subexpression = try!(self.parse_prefix_expr()); |
