about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-11-14 02:46:12 -0800
committerGitHub <noreply@github.com>2016-11-14 02:46:12 -0800
commit8289a8916f9cf7d290a98121a75cee840faa9d0f (patch)
tree7ed4b2e31762811bbc310b9b003bb11026b33faf
parent7bef60a64894b0606ad9f5dc76256d5321b270a6 (diff)
parentcf9ff2b59bf876650b1e13ab66078bfd22ac85ef (diff)
downloadrust-8289a8916f9cf7d290a98121a75cee840faa9d0f.tar.gz
rust-8289a8916f9cf7d290a98121a75cee840faa9d0f.zip
Auto merge of #37278 - matklad:lone-lifetime, r=jseyfried
Fix syntax error in the compiler

Currently `rustc` accepts the following code: `fn f<'a>() where 'a {}`. This should be a syntax error, shouldn't it?

Not sure if my changes actually compile, waiting for the LLVM to build.
-rw-r--r--src/librustc_borrowck/borrowck/mir/dataflow/graphviz.rs2
-rw-r--r--src/libsyntax/parse/parser.rs2
-rw-r--r--src/test/parse-fail/where-clauses-no-bounds-or-predicates.rs5
3 files changed, 6 insertions, 3 deletions
diff --git a/src/librustc_borrowck/borrowck/mir/dataflow/graphviz.rs b/src/librustc_borrowck/borrowck/mir/dataflow/graphviz.rs
index 28f58723862..8461f6d061a 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 c3f8a79c1cc..2e38ca82d5d 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -4409,7 +4409,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 45165b76c4a..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.
 //
@@ -20,5 +20,8 @@ fn equal2<T>(_: &T, _: &T) -> bool where T: {
     true
 }
 
+fn foo<'a>() where 'a {}
+//~^ ERROR expected `:`, found `{`
+
 fn main() {
 }