Skip to content

Commit 8289a89

Browse files
authored
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.
2 parents 7bef60a + cf9ff2b commit 8289a89

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
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
@@ -4409,7 +4409,7 @@ impl<'a> Parser<'a> {
44094409
let bounded_lifetime =
44104410
self.parse_lifetime()?;
44114411

4412-
self.eat(&token::Colon);
4412+
self.expect(&token::Colon)?;
44134413

44144414
let bounds =
44154415
self.parse_lifetimes(token::BinOp(token::Plus))?;

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

+4-1
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
//
@@ -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)