diff options
| author | Aleksey Kladov <aleksey.kladov@gmail.com> | 2016-10-19 18:21:27 +0300 |
|---|---|---|
| committer | Aleksey Kladov <aleksey.kladov@gmail.com> | 2016-11-14 10:23:20 +0300 |
| commit | cf9ff2b59bf876650b1e13ab66078bfd22ac85ef (patch) | |
| tree | cc220789e5ba1885805fad28409cab5f511a25c3 /src | |
| parent | a41505f4f4a93bf94f4f7439d41afd826ab20b94 (diff) | |
| download | rust-cf9ff2b59bf876650b1e13ab66078bfd22ac85ef.tar.gz rust-cf9ff2b59bf876650b1e13ab66078bfd22ac85ef.zip | |
Fix where clauses parsing
Don't allow lifetimes without any bounds at all
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_borrowck/borrowck/mir/dataflow/graphviz.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 2 | ||||
| -rw-r--r-- | src/test/parse-fail/where-clauses-no-bounds-or-predicates.rs | 7 |
3 files changed, 7 insertions, 4 deletions
diff --git a/src/librustc_borrowck/borrowck/mir/dataflow/graphviz.rs b/src/librustc_borrowck/borrowck/mir/dataflow/graphviz.rs index f6260527039..0694bbab66f 100644 --- a/src/librustc_borrowck/borrowck/mir/dataflow/graphviz.rs +++ b/src/librustc_borrowck/borrowck/mir/dataflow/graphviz.rs @@ -88,7 +88,7 @@ pub trait MirWithFlowState<'tcx> { } 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; fn node_id(&self) -> NodeId { self.node_id } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 61268d457ce..e1de32de790 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -4440,7 +4440,7 @@ impl<'a> Parser<'a> { let bounded_lifetime = self.parse_lifetime()?; - self.eat(&token::Colon); + self.expect(&token::Colon)?; let bounds = self.parse_lifetimes(token::BinOp(token::Plus))?; diff --git a/src/test/parse-fail/where-clauses-no-bounds-or-predicates.rs b/src/test/parse-fail/where-clauses-no-bounds-or-predicates.rs index 3ac71176342..78d97454087 100644 --- a/src/test/parse-fail/where-clauses-no-bounds-or-predicates.rs +++ b/src/test/parse-fail/where-clauses-no-bounds-or-predicates.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // 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 { //~^ 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 } +fn foo<'a>() where 'a {} +//~^ ERROR expected `:`, found `{` + fn main() { } |
