about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2018-03-06 11:22:24 +0100
committerRalf Jung <post@ralfj.de>2018-03-06 11:29:48 +0100
commit49abd8748357012e5db10bf11077384f727e2177 (patch)
tree21efac585e6effe851d9b05497d0aca78bb22f5d /src/libsyntax/parse
parent30b5be0e9530a4de106b581074c3707e6a938329 (diff)
downloadrust-49abd8748357012e5db10bf11077384f727e2177.tar.gz
rust-49abd8748357012e5db10bf11077384f727e2177.zip
make bounds on higher-kinded lifetimes a hard error in ast_validation
Also move the check for not having type parameters into ast_validation.

I was not sure what to do with compile-fail/issue-23046.rs: The issue looks like
maybe the bounds actually played a role in triggering the ICE, but that seems
unlikely given that the compiler seems to entirely ignore them.  However, I
couldn't find a testcase without the bounds, so I figured the best I could do is
to just remove the bounds and make sure at least that keeps working.
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 09dd00fa5fa..ba8ccc2256f 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -5484,18 +5484,8 @@ impl<'a> Parser<'a> {
             self.expect_lt()?;
             let params = self.parse_generic_params()?;
             self.expect_gt()?;
-
-            let first_non_lifetime_param_span = params.iter()
-                .filter_map(|param| match *param {
-                    ast::GenericParam::Lifetime(_) => None,
-                    ast::GenericParam::Type(ref t) => Some(t.span),
-                })
-                .next();
-
-            if let Some(span) = first_non_lifetime_param_span {
-                self.span_err(span, "only lifetime parameters can be used in this context");
-            }
-
+            // We rely on AST validation to rule out invalid cases: There must not be type
+            // parameters, and the lifetime parameters must not have bounds.
             Ok(params)
         } else {
             Ok(Vec::new())