Skip to content

Commit a8b7146

Browse files
committed
Auto merge of #27432 - sanxiyn:impl-dotdot, r=sfackler
Fix #27255.
2 parents 8c634ce + b5139c5 commit a8b7146

File tree

5 files changed

+19
-4
lines changed

5 files changed

+19
-4
lines changed

src/libsyntax/parse/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4610,7 +4610,7 @@ impl<'a> Parser<'a> {
46104610
None
46114611
};
46124612

4613-
if try!(self.eat(&token::DotDot) ){
4613+
if opt_trait.is_some() && try!(self.eat(&token::DotDot) ){
46144614
if generics.is_parameterized() {
46154615
self.span_err(impl_span, "default trait implementations are not \
46164616
allowed to have generics");

src/test/parse-fail/empty-impl-semicolon.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010

1111
// compile-flags: -Z parse-only
1212

13-
impl Foo; //~ ERROR expected one of `(`, `+`, `..`, `::`, `<`, `for`, `where`, or `{`, found `;`
13+
impl Foo; //~ ERROR expected one of `(`, `+`, `::`, `<`, `for`, `where`, or `{`, found `;`

src/test/parse-fail/issue-27255.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// compile-flags: -Z parse-only
12+
13+
impl A .. {} //~ ERROR
14+
15+
fn main() {}

src/test/parse-fail/multitrait.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct S {
1515
}
1616

1717
impl Cmp, ToString for S {
18-
//~^ ERROR: expected one of `(`, `+`, `..`, `::`, `<`, `for`, `where`, or `{`, found `,`
18+
//~^ ERROR: expected one of `(`, `+`, `::`, `<`, `for`, `where`, or `{`, found `,`
1919
fn eq(&&other: S) { false }
2020
fn to_string(&self) -> String { "hi".to_string() }
2121
}

src/test/parse-fail/trait-bounds-not-on-impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct Bar;
1717

1818
impl Foo + Owned for Bar {
1919
//~^ ERROR not a trait
20-
//~^^ ERROR expected one of `..`, `where`, or `{`, found `Bar`
20+
//~^^ ERROR expected one of `where` or `{`, found `Bar`
2121
}
2222

2323
fn main() { }

0 commit comments

Comments
 (0)