about summary refs log tree commit diff
path: root/compiler/rustc_parse/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-03-02 12:57:06 +0000
committerbors <bors@rust-lang.org>2021-03-02 12:57:06 +0000
commit67342b830ebeca05ebafc09d8c7ed71b2ad821e1 (patch)
tree4f22db53302ec9f0e7961f6ae92c28f79e87f5df /compiler/rustc_parse/src
parentedeee915b1c52f97411e57ef6b1a8bd46548a37a (diff)
parent97f9b186ae6fbd03d9bf4892ec0320f17c623b6b (diff)
downloadrust-67342b830ebeca05ebafc09d8c7ed71b2ad821e1.tar.gz
rust-67342b830ebeca05ebafc09d8c7ed71b2ad821e1.zip
Auto merge of #82698 - JohnTitor:rollup-htd533c, r=JohnTitor
Rollup of 10 pull requests

Successful merges:

 - #80189 (Convert primitives in the standard library to intra-doc links)
 - #80874 (Update intra-doc link documentation to match the implementation)
 - #82376 (Add option to enable MIR inlining independently of mir-opt-level)
 - #82516 (Add incomplete feature gate for inherent associate types.)
 - #82579 (Fix turbofish recovery with multiple generic args)
 - #82593 (Teach rustdoc how to display WASI.)
 - #82597 (Get TyCtxt from self instead of passing as argument in AutoTraitFinder)
 - #82627 (Erase late bound regions to avoid ICE)
 - #82661 (:arrow_up: rust-analyzer)
 - #82691 (Update books)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src')
-rw-r--r--compiler/rustc_parse/src/parser/diagnostics.rs2
-rw-r--r--compiler/rustc_parse/src/parser/path.rs2
-rw-r--r--compiler/rustc_parse/src/parser/ty.rs12
3 files changed, 12 insertions, 4 deletions
diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs
index 5b4939b7407..f4ab3260d1a 100644
--- a/compiler/rustc_parse/src/parser/diagnostics.rs
+++ b/compiler/rustc_parse/src/parser/diagnostics.rs
@@ -662,7 +662,7 @@ impl<'a> Parser<'a> {
                     let x = self.parse_seq_to_before_end(
                         &token::Gt,
                         SeqSep::trailing_allowed(token::Comma),
-                        |p| p.parse_ty(),
+                        |p| p.parse_generic_arg(),
                     );
                     match x {
                         Ok((_, _, false)) => {
diff --git a/compiler/rustc_parse/src/parser/path.rs b/compiler/rustc_parse/src/parser/path.rs
index 6b7059eecf4..9cc600d9ede 100644
--- a/compiler/rustc_parse/src/parser/path.rs
+++ b/compiler/rustc_parse/src/parser/path.rs
@@ -545,7 +545,7 @@ impl<'a> Parser<'a> {
 
     /// Parse a generic argument in a path segment.
     /// This does not include constraints, e.g., `Item = u8`, which is handled in `parse_angle_arg`.
-    fn parse_generic_arg(&mut self) -> PResult<'a, Option<GenericArg>> {
+    pub(super) fn parse_generic_arg(&mut self) -> PResult<'a, Option<GenericArg>> {
         let start = self.token.span;
         let arg = if self.check_lifetime() && self.look_ahead(1, |t| !t.is_like_plus()) {
             // Parse lifetime argument.
diff --git a/compiler/rustc_parse/src/parser/ty.rs b/compiler/rustc_parse/src/parser/ty.rs
index 9553f5d09e8..8f03bfd4c3a 100644
--- a/compiler/rustc_parse/src/parser/ty.rs
+++ b/compiler/rustc_parse/src/parser/ty.rs
@@ -360,12 +360,20 @@ impl<'a> Parser<'a> {
             }
             Err(err) => return Err(err),
         };
+
         let ty = if self.eat(&token::Semi) {
-            TyKind::Array(elt_ty, self.parse_anon_const_expr()?)
+            let mut length = self.parse_anon_const_expr()?;
+            if let Err(e) = self.expect(&token::CloseDelim(token::Bracket)) {
+                // Try to recover from `X<Y, ...>` when `X::<Y, ...>` works
+                self.check_mistyped_turbofish_with_multiple_type_params(e, &mut length.value)?;
+                self.expect(&token::CloseDelim(token::Bracket))?;
+            }
+            TyKind::Array(elt_ty, length)
         } else {
+            self.expect(&token::CloseDelim(token::Bracket))?;
             TyKind::Slice(elt_ty)
         };
-        self.expect(&token::CloseDelim(token::Bracket))?;
+
         Ok(ty)
     }