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.
This commit is contained in:
parent
30b5be0e95
commit
49abd87483
11 changed files with 182 additions and 183 deletions
|
@ -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())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue