Skip to content

Commit cf9ff2b

Browse files
committed
Fix where clauses parsing
Don't allow lifetimes without any bounds at all
1 parent a41505f commit cf9ff2b

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/librustc_borrowck/borrowck/mir/dataflow/graphviz.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ pub trait MirWithFlowState<'tcx> {
8888
}
8989

9090
impl<'a, 'tcx: 'a, BD> MirWithFlowState<'tcx> for MirBorrowckCtxtPreDataflow<'a, 'tcx, BD>
91-
where 'a, 'tcx: 'a, BD: BitDenotation<Ctxt=MoveDataParamEnv<'tcx>>
91+
where 'tcx: 'a, BD: BitDenotation<Ctxt=MoveDataParamEnv<'tcx>>
9292
{
9393
type BD = BD;
9494
fn node_id(&self) -> NodeId { self.node_id }

src/libsyntax/parse/parser.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4440,7 +4440,7 @@ impl<'a> Parser<'a> {
44404440
let bounded_lifetime =
44414441
self.parse_lifetime()?;
44424442

4443-
self.eat(&token::Colon);
4443+
self.expect(&token::Colon)?;
44444444

44454445
let bounds =
44464446
self.parse_lifetimes(token::BinOp(token::Plus))?;

src/test/parse-fail/where-clauses-no-bounds-or-predicates.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: -Z parse-only
11+
// compile-flags: -Z parse-only -Z continue-parse-after-error
1212

1313
fn equal1<T>(_: &T, _: &T) -> bool where {
1414
//~^ ERROR a `where` clause must have at least one predicate in it
@@ -20,5 +20,8 @@ fn equal2<T>(_: &T, _: &T) -> bool where T: {
2020
true
2121
}
2222

23+
fn foo<'a>() where 'a {}
24+
//~^ ERROR expected `:`, found `{`
25+
2326
fn main() {
2427
}

0 commit comments

Comments
 (0)