about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-02-15 13:35:20 +0000
committerbors <bors@rust-lang.org>2018-02-15 13:35:20 +0000
commit1670a532dd769763f1d6ad9e5d624ec31361a098 (patch)
tree9e7f596ee88967152d1f6ed887476447ccb3c3a7 /src/libsyntax
parentc83fa5d91c3b16459ab7b87c48ed18bd059a23af (diff)
parent03b089d2208167d113cb7bb81f2de48b78785658 (diff)
downloadrust-1670a532dd769763f1d6ad9e5d624ec31361a098.tar.gz
rust-1670a532dd769763f1d6ad9e5d624ec31361a098.zip
Auto merge of #48203 - kennytm:rollup, r=kennytm
Rollup of 23 pull requests

- Successful merges: #47784, #47806, #47846, #48005, #48033, #48065, #48087, #48114, #48126, #48130, #48133, #48151, #48154, #48156, #48162, #48163, #48165, #48167, #48181, #48186, #48195, #48035, #48210
- Failed merges:
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/codemap.rs8
-rw-r--r--src/libsyntax/feature_gate.rs2
-rw-r--r--src/libsyntax/parse/parser.rs21
3 files changed, 22 insertions, 9 deletions
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs
index 3601b9ba8a8..ff6f32fc3be 100644
--- a/src/libsyntax/codemap.rs
+++ b/src/libsyntax/codemap.rs
@@ -690,14 +690,16 @@ impl CodeMap {
             return 1;
         }
 
+        let src = local_begin.fm.external_src.borrow();
+
         // We need to extend the snippet to the end of the src rather than to end_index so when
         // searching forwards for boundaries we've got somewhere to search.
         let snippet = if let Some(ref src) = local_begin.fm.src {
             let len = src.len();
-            (&src[start_index..len]).to_string()
-        } else if let Some(src) = local_begin.fm.external_src.borrow().get_source() {
+            (&src[start_index..len])
+        } else if let Some(src) = src.get_source() {
             let len = src.len();
-            (&src[start_index..len]).to_string()
+            (&src[start_index..len])
         } else {
             return 1;
         };
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index ea916d5168c..3b137f9570a 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -541,7 +541,7 @@ declare_features! (
     // instead of just the platforms on which it is the C ABI
     (accepted, abi_sysv64, "1.24.0", Some(36167)),
     // Allows `repr(align(16))` struct attribute (RFC 1358)
-    (accepted, repr_align, "1.24.0", Some(33626)),
+    (accepted, repr_align, "1.25.0", Some(33626)),
     // allow '|' at beginning of match arms (RFC 1925)
     (accepted, match_beginning_vert, "1.25.0", Some(44101)),
     // Nested groups in `use` (RFC 2128)
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index dc3745fc4a3..ac582627f88 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -4859,19 +4859,30 @@ impl<'a> Parser<'a> {
                 |p| {
                     if p.token == token::DotDotDot {
                         p.bump();
+                        variadic = true;
                         if allow_variadic {
                             if p.token != token::CloseDelim(token::Paren) {
                                 let span = p.span;
                                 p.span_err(span,
                                     "`...` must be last in argument list for variadic function");
                             }
+                            Ok(None)
                         } else {
-                            let span = p.span;
-                            p.span_err(span,
-                                       "only foreign functions are allowed to be variadic");
+                            let span = p.prev_span;
+                            if p.token == token::CloseDelim(token::Paren) {
+                                // continue parsing to present any further errors
+                                p.struct_span_err(
+                                    span,
+                                    "only foreign functions are allowed to be variadic"
+                                ).emit();
+                                Ok(Some(dummy_arg(span)))
+                           } else {
+                               // this function definition looks beyond recovery, stop parsing
+                                p.span_err(span,
+                                           "only foreign functions are allowed to be variadic");
+                                Ok(None)
+                            }
                         }
-                        variadic = true;
-                        Ok(None)
                     } else {
                         match p.parse_arg_general(named_args) {
                             Ok(arg) => Ok(Some(arg)),