1
Fork 0

Fix where clauses parsing

Don't allow lifetimes without any bounds at all
This commit is contained in:
Aleksey Kladov 2016-10-19 18:21:27 +03:00
parent a41505f4f4
commit cf9ff2b59b
3 changed files with 7 additions and 4 deletions

View file

@ -88,7 +88,7 @@ pub trait MirWithFlowState<'tcx> {
} }
impl<'a, 'tcx: 'a, BD> MirWithFlowState<'tcx> for MirBorrowckCtxtPreDataflow<'a, 'tcx, BD> impl<'a, 'tcx: 'a, BD> MirWithFlowState<'tcx> for MirBorrowckCtxtPreDataflow<'a, 'tcx, BD>
where 'a, 'tcx: 'a, BD: BitDenotation<Ctxt=MoveDataParamEnv<'tcx>> where 'tcx: 'a, BD: BitDenotation<Ctxt=MoveDataParamEnv<'tcx>>
{ {
type BD = BD; type BD = BD;
fn node_id(&self) -> NodeId { self.node_id } fn node_id(&self) -> NodeId { self.node_id }

View file

@ -4440,7 +4440,7 @@ impl<'a> Parser<'a> {
let bounded_lifetime = let bounded_lifetime =
self.parse_lifetime()?; self.parse_lifetime()?;
self.eat(&token::Colon); self.expect(&token::Colon)?;
let bounds = let bounds =
self.parse_lifetimes(token::BinOp(token::Plus))?; self.parse_lifetimes(token::BinOp(token::Plus))?;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //
@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
// compile-flags: -Z parse-only // compile-flags: -Z parse-only -Z continue-parse-after-error
fn equal1<T>(_: &T, _: &T) -> bool where { fn equal1<T>(_: &T, _: &T) -> bool where {
//~^ ERROR a `where` clause must have at least one predicate in it //~^ ERROR a `where` clause must have at least one predicate in it
@ -20,5 +20,8 @@ fn equal2<T>(_: &T, _: &T) -> bool where T: {
true true
} }
fn foo<'a>() where 'a {}
//~^ ERROR expected `:`, found `{`
fn main() { fn main() {
} }