]> git.lizzy.rs Git - rust.git/commitdiff
auto merge of #8547 : kballard/rust/trait-parse-err-msg, r=alexcrichton
authorbors <bors@rust-lang.org>
Sun, 18 Aug 2013 05:52:00 +0000 (22:52 -0700)
committerbors <bors@rust-lang.org>
Sun, 18 Aug 2013 05:52:00 +0000 (22:52 -0700)
When parsing a trait function, the function must end with either `;` or
`{` (signifying a default implementation). The error message incorrectly
stated that it must be `;` or `}`.

Fixes #6610.

src/libsyntax/parse/parser.rs
src/test/compile-fail/issue-6610.rs [new file with mode: 0644]

index a2664dcf890ad3b3a44d035c05399b291e8c7dc6..de7abb8d1f46d290738cf7c16c9d1ada65f15006 100644 (file)
@@ -953,7 +953,7 @@ pub fn parse_trait_methods(&self) -> ~[trait_method] {
               _ => {
                     p.fatal(
                         fmt!(
-                            "expected `;` or `}` but found `%s`",
+                            "expected `;` or `{` but found `%s`",
                             self.this_token_to_str()
                         )
                     );
diff --git a/src/test/compile-fail/issue-6610.rs b/src/test/compile-fail/issue-6610.rs
new file mode 100644 (file)
index 0000000..f90833a
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2013 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.
+
+trait Foo { fn a() } //~ ERROR expected `;` or `{` but found `}`
+
+fn main() {}