about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorKamal Marhubi <kamal@marhubi.com>2016-03-29 00:04:44 -0400
committerKamal Marhubi <kamal@marhubi.com>2016-03-29 00:04:44 -0400
commitf2b5931c6da8a6e2fa0a5c82f3ece74a1c95e093 (patch)
treed90400208a98320776d18c97c770cb25ac588279 /src
parent652653374544237fda15e15bf2c351995eb8f4c2 (diff)
deps: Update syntex_syntax to 0.30.0
This bump includes ability to parse inclusive ranges (`a...b`) and the
question mark operator.

Refs #867, #890
Diffstat (limited to 'src')
-rw-r--r--src/expr.rs13
-rw-r--r--src/lib.rs5
2 files changed, 12 insertions, 6 deletions
diff --git a/src/expr.rs b/src/expr.rs
index d933f68ce18..a1e8a17c091 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -185,19 +185,21 @@ impl Rewrite for ast::Expr {
             ast::ExprKind::Repeat(ref expr, ref repeats) => {
                 rewrite_pair(&**expr, &**repeats, "[", "; ", "]", context, width, offset)
             }
-            ast::ExprKind::Range(Some(ref lhs), Some(ref rhs)) => {
+            // TODO(#890): Handle closed ranges; rust tracking issue
+            //   https://github.com/rust-lang/rust/issues/28237
+            ast::ExprKind::Range(Some(ref lhs), Some(ref rhs), _range_limits) => {
                 rewrite_pair(&**lhs, &**rhs, "", "..", "", context, width, offset)
             }
-            ast::ExprKind::Range(None, Some(ref rhs)) => {
+            ast::ExprKind::Range(None, Some(ref rhs), _range_limits) => {
                 rewrite_unary_prefix(context, "..", &**rhs, width, offset)
             }
-            ast::ExprKind::Range(Some(ref lhs), None) => {
+            ast::ExprKind::Range(Some(ref lhs), None, _range_limits) => {
                 Some(format!("{}..",
                              try_opt!(lhs.rewrite(context,
                                                   try_opt!(width.checked_sub(2)),
                                                   offset))))
             }
-            ast::ExprKind::Range(None, None) => {
+            ast::ExprKind::Range(None, None, _range_limits) => {
                 if width >= 2 {
                     Some("..".into())
                 } else {
@@ -213,6 +215,9 @@ impl Rewrite for ast::Expr {
                          width,
                          offset)
             }
+            // TODO(#867): Handle type ascription; rust tracking issue
+            //   https://github.com/rust-lang/rust/issues/31436
+            ast::ExprKind::Try(_) => unimplemented!(),
         };
         result.and_then(|res| recover_comment_removed(res, self.span, context, width, offset))
     }
diff --git a/src/lib.rs b/src/lib.rs
index 7e074f05124..3443db338cf 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -381,7 +381,8 @@ pub fn format_string(input: String, config: &Config) -> FileMap {
     let krate = parse::parse_crate_from_source_str(path.to_owned(),
                                                    input,
                                                    Vec::new(),
-                                                   &parse_session);
+                                                   &parse_session)
+                    .unwrap();
 
     // Suppress error output after parsing.
     let silent_emitter = Box::new(EmitterWriter::new(Box::new(Vec::new()), None, codemap.clone()));
@@ -412,7 +413,7 @@ pub fn format(file: &Path, config: &Config) -> FileMap {
                                                 codemap.clone());
     let mut parse_session = ParseSess::with_span_handler(tty_handler, codemap.clone());
 
-    let krate = parse::parse_crate_from_file(file, Vec::new(), &parse_session);
+    let krate = parse::parse_crate_from_file(file, Vec::new(), &parse_session).unwrap();
 
     // Suppress error output after parsing.
     let silent_emitter = Box::new(EmitterWriter::new(Box::new(Vec::new()), None, codemap.clone()));