about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/path.rs
diff options
context:
space:
mode:
authorkadmin <julianknodt@gmail.com>2022-01-08 09:28:12 +0000
committerkadmin <julianknodt@gmail.com>2022-01-17 17:44:56 +0000
commit67f56671d0384bdb2d92dddebfbf42510b16e0f7 (patch)
tree40e044743da8fab20f86e317f65f1276e78343c5 /compiler/rustc_parse/src/parser/path.rs
parentfb57b7518d207caa99bdd99f4dab2a7d3902a83a (diff)
downloadrust-67f56671d0384bdb2d92dddebfbf42510b16e0f7.tar.gz
rust-67f56671d0384bdb2d92dddebfbf42510b16e0f7.zip
Use Term in ProjectionPredicate
ProjectionPredicate should be able to handle both associated types and consts so this adds the
first step of that. It mainly just pipes types all the way down, not entirely sure how to handle
consts, but hopefully that'll come with time.
Diffstat (limited to 'compiler/rustc_parse/src/parser/path.rs')
-rw-r--r--compiler/rustc_parse/src/parser/path.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/compiler/rustc_parse/src/parser/path.rs b/compiler/rustc_parse/src/parser/path.rs
index 8f272820015..531cac1f57e 100644
--- a/compiler/rustc_parse/src/parser/path.rs
+++ b/compiler/rustc_parse/src/parser/path.rs
@@ -503,17 +503,15 @@ impl<'a> Parser<'a> {
     ) -> PResult<'a, AssocConstraintKind> {
         let arg = self.parse_generic_arg(None)?;
         let span = ident.span.to(self.prev_token.span);
-        let ty = match arg {
-            Some(GenericArg::Type(ty)) => ty,
-            Some(GenericArg::Const(c)) => {
-                return Ok(AssocConstraintKind::Equality { term: c.into() });
-            }
+        let term = match arg {
+            Some(GenericArg::Type(ty)) => ty.into(),
+            Some(GenericArg::Const(c)) => c.into(),
             Some(GenericArg::Lifetime(lt)) => {
                 self.struct_span_err(span, "associated lifetimes are not supported")
                     .span_label(lt.ident.span, "the lifetime is given here")
                     .help("if you meant to specify a trait object, write `dyn Trait + 'lifetime`")
                     .emit();
-                self.mk_ty(span, ast::TyKind::Err)
+                self.mk_ty(span, ast::TyKind::Err).into()
             }
             None => {
                 let after_eq = eq.shrink_to_hi();
@@ -542,7 +540,7 @@ impl<'a> Parser<'a> {
                 return Err(err);
             }
         };
-        Ok(AssocConstraintKind::Equality { term: ty.into() })
+        Ok(AssocConstraintKind::Equality { term })
     }
 
     /// We do not permit arbitrary expressions as const arguments. They must be one of: