From 49abd8748357012e5db10bf11077384f727e2177 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 6 Mar 2018 11:22:24 +0100 Subject: 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. --- src/libsyntax/parse/parser.rs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'src/libsyntax/parse') 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()) -- cgit 1.4.1-3-g733a5 From 780b544a391fb2dc42d814ce8cb7e6ad3633fa39 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 6 Mar 2018 11:33:26 +0100 Subject: note a FIXME --- src/libsyntax/parse/parser.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'src/libsyntax/parse') diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index ba8ccc2256f..b60a6b32fab 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -4827,6 +4827,7 @@ impl<'a> Parser<'a> { } )); // FIXME: Decide what should be used here, `=` or `==`. + // FIXME: We are just dropping the binders in lifetime_defs on the floor here. } else if self.eat(&token::Eq) || self.eat(&token::EqEq) { let rhs_ty = self.parse_ty()?; where_clause.predicates.push(ast::WherePredicate::EqPredicate( -- cgit 1.4.1-3-g733a5