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.
This commit is contained in:
bors
2016-11-14 02:46:12 -08:00
committed by GitHub
3 changed files with 6 additions and 3 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

@@ -4409,7 +4409,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.
// //
@@ -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() {
} }