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
commit 8289a8916f
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>
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 }

View File

@ -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))?;

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
// 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() {
}