diff options
| author | bors <bors@rust-lang.org> | 2015-07-31 22:17:12 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-07-31 22:17:12 +0000 |
| commit | a8b7146f70f9c9409d205adc324da559dfd4ddde (patch) | |
| tree | 6846b844ad75bbc6fb2b37cf6030e6e0c07a9f11 /src | |
| parent | 8c634cef958acca4083d677f0ec17ada543077e9 (diff) | |
| parent | b5139c5c5868f6f27e06f458fa8ee54c9e8adffb (diff) | |
| download | rust-a8b7146f70f9c9409d205adc324da559dfd4ddde.tar.gz rust-a8b7146f70f9c9409d205adc324da559dfd4ddde.zip | |
Auto merge of #27432 - sanxiyn:impl-dotdot, r=sfackler
Fix #27255.
Diffstat (limited to 'src')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 2 | ||||
| -rw-r--r-- | src/test/parse-fail/empty-impl-semicolon.rs | 2 | ||||
| -rw-r--r-- | src/test/parse-fail/issue-27255.rs | 15 | ||||
| -rw-r--r-- | src/test/parse-fail/multitrait.rs | 2 | ||||
| -rw-r--r-- | src/test/parse-fail/trait-bounds-not-on-impl.rs | 2 |
5 files changed, 19 insertions, 4 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 11611c9adb0..e7ab9a73c0f 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -4610,7 +4610,7 @@ impl<'a> Parser<'a> { None }; - if try!(self.eat(&token::DotDot) ){ + if opt_trait.is_some() && try!(self.eat(&token::DotDot) ){ if generics.is_parameterized() { self.span_err(impl_span, "default trait implementations are not \ allowed to have generics"); diff --git a/src/test/parse-fail/empty-impl-semicolon.rs b/src/test/parse-fail/empty-impl-semicolon.rs index e356ab1debc..d9f8add8cfb 100644 --- a/src/test/parse-fail/empty-impl-semicolon.rs +++ b/src/test/parse-fail/empty-impl-semicolon.rs @@ -10,4 +10,4 @@ // compile-flags: -Z parse-only -impl Foo; //~ ERROR expected one of `(`, `+`, `..`, `::`, `<`, `for`, `where`, or `{`, found `;` +impl Foo; //~ ERROR expected one of `(`, `+`, `::`, `<`, `for`, `where`, or `{`, found `;` diff --git a/src/test/parse-fail/issue-27255.rs b/src/test/parse-fail/issue-27255.rs new file mode 100644 index 00000000000..a751c4af494 --- /dev/null +++ b/src/test/parse-fail/issue-27255.rs @@ -0,0 +1,15 @@ +// Copyright 2015 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. + +// compile-flags: -Z parse-only + +impl A .. {} //~ ERROR + +fn main() {} diff --git a/src/test/parse-fail/multitrait.rs b/src/test/parse-fail/multitrait.rs index a1c737609d1..2a8d6d99957 100644 --- a/src/test/parse-fail/multitrait.rs +++ b/src/test/parse-fail/multitrait.rs @@ -15,7 +15,7 @@ struct S { } impl Cmp, ToString for S { -//~^ ERROR: expected one of `(`, `+`, `..`, `::`, `<`, `for`, `where`, or `{`, found `,` +//~^ ERROR: expected one of `(`, `+`, `::`, `<`, `for`, `where`, or `{`, found `,` fn eq(&&other: S) { false } fn to_string(&self) -> String { "hi".to_string() } } diff --git a/src/test/parse-fail/trait-bounds-not-on-impl.rs b/src/test/parse-fail/trait-bounds-not-on-impl.rs index 7a20b00ce12..3bd8908d18b 100644 --- a/src/test/parse-fail/trait-bounds-not-on-impl.rs +++ b/src/test/parse-fail/trait-bounds-not-on-impl.rs @@ -17,7 +17,7 @@ struct Bar; impl Foo + Owned for Bar { //~^ ERROR not a trait -//~^^ ERROR expected one of `..`, `where`, or `{`, found `Bar` +//~^^ ERROR expected one of `where` or `{`, found `Bar` } fn main() { } |
