Skip to content

Commit

Permalink
Auto merge of #37753 - est31:master, r=petrochenkov
Browse files Browse the repository at this point in the history
Fix empty lifetime list or one with trailing comma being rejected

Fixes #37733
  • Loading branch information
bors authored Nov 13, 2016
2 parents ea02f87 + 34f33ec commit 876b761
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1902,12 +1902,12 @@ impl<'a> Parser<'a> {
if let Some(recv) = followed_by_ty_params {
assert!(recv.is_empty());
*recv = attrs;
} else {
debug!("parse_lifetime_defs ret {:?}", res);
return Ok(res);
} else if !attrs.is_empty() {
let msg = "trailing attribute after lifetime parameters";
return Err(self.fatal(msg));
}
debug!("parse_lifetime_defs ret {:?}", res);
return Ok(res);
}
}

Expand Down
15 changes: 15 additions & 0 deletions src/test/run-pass/issue-37733.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// 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.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

type A = for<> fn();

type B = for<'a,> fn();

pub fn main() {}

0 comments on commit 876b761

Please sign in to comment.