From 7129e8815e3203ceae5bb85b0faa8e8753e520e3 Mon Sep 17 00:00:00 2001 From: Sean Patrick Santos Date: Sun, 15 Mar 2015 19:35:25 -0600 Subject: Functional changes for associated constants. Cross-crate usage of associated constants is not yet working. --- src/test/parse-fail/issue-20711-2.rs | 2 +- src/test/parse-fail/issue-20711.rs | 2 +- src/test/parse-fail/issue-21153.rs | 2 +- src/test/parse-fail/removed-syntax-static-fn.rs | 2 +- src/test/parse-fail/trait-pub-assoc-const.rs | 16 ++++++++++++++++ src/test/parse-fail/trait-pub-assoc-ty.rs | 3 ++- src/test/parse-fail/trait-pub-method.rs | 3 ++- 7 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 src/test/parse-fail/trait-pub-assoc-const.rs (limited to 'src/test/parse-fail') diff --git a/src/test/parse-fail/issue-20711-2.rs b/src/test/parse-fail/issue-20711-2.rs index 2c993b7654e..be6bd516d6f 100644 --- a/src/test/parse-fail/issue-20711-2.rs +++ b/src/test/parse-fail/issue-20711-2.rs @@ -16,6 +16,6 @@ impl Foo { fn foo() {} #[stable(feature = "rust1", since = "1.0.0")] -} //~ ERROR expected one of `extern`, `fn`, `pub`, `type`, or `unsafe`, found `}` +} //~ ERROR expected one of `const`, `extern`, `fn`, `pub`, `type`, or `unsafe`, found `}` fn main() {} diff --git a/src/test/parse-fail/issue-20711.rs b/src/test/parse-fail/issue-20711.rs index 8462bd8fd01..d1d8d3acf91 100644 --- a/src/test/parse-fail/issue-20711.rs +++ b/src/test/parse-fail/issue-20711.rs @@ -14,6 +14,6 @@ struct Foo; impl Foo { #[stable(feature = "rust1", since = "1.0.0")] -} //~ ERROR expected one of `extern`, `fn`, `pub`, `type`, or `unsafe`, found `}` +} //~ ERROR expected one of `const`, `extern`, `fn`, `pub`, `type`, or `unsafe`, found `}` fn main() {} diff --git a/src/test/parse-fail/issue-21153.rs b/src/test/parse-fail/issue-21153.rs index 44d979ba979..76a4687f544 100644 --- a/src/test/parse-fail/issue-21153.rs +++ b/src/test/parse-fail/issue-21153.rs @@ -11,5 +11,5 @@ // compile-flags: -Z parse-only trait MyTrait: Iterator { - Item = T; //~ ERROR expected one of `extern`, `fn`, `type`, or `unsafe`, found `Item` + Item = T; //~ ERROR expected one of `const`, `extern`, `fn`, `type`, or `unsafe`, found `Item` } diff --git a/src/test/parse-fail/removed-syntax-static-fn.rs b/src/test/parse-fail/removed-syntax-static-fn.rs index be1e89dd717..7b6caad86b6 100644 --- a/src/test/parse-fail/removed-syntax-static-fn.rs +++ b/src/test/parse-fail/removed-syntax-static-fn.rs @@ -14,5 +14,5 @@ struct S; impl S { static fn f() {} - //~^ ERROR expected one of `extern`, `fn`, `pub`, `type`, `unsafe`, or `}`, found `static` } +//~^^ ERROR expected one of `const`, `extern`, `fn`, `pub`, `type`, `unsafe`, or `}`, found `static` diff --git a/src/test/parse-fail/trait-pub-assoc-const.rs b/src/test/parse-fail/trait-pub-assoc-const.rs new file mode 100644 index 00000000000..adce0d7bbf4 --- /dev/null +++ b/src/test/parse-fail/trait-pub-assoc-const.rs @@ -0,0 +1,16 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +trait Foo { + pub const Foo: u32; + //~^ ERROR expected one of `const`, `extern`, `fn`, `type`, or `unsafe`, found `pub` +} + +fn main() {} diff --git a/src/test/parse-fail/trait-pub-assoc-ty.rs b/src/test/parse-fail/trait-pub-assoc-ty.rs index 02d76234d4e..dab6c433aba 100644 --- a/src/test/parse-fail/trait-pub-assoc-ty.rs +++ b/src/test/parse-fail/trait-pub-assoc-ty.rs @@ -9,7 +9,8 @@ // except according to those terms. trait Foo { - pub type Foo; //~ ERROR expected one of `extern`, `fn`, `type`, or `unsafe`, found `pub` + pub type Foo; + //~^ ERROR expected one of `const`, `extern`, `fn`, `type`, or `unsafe`, found `pub` } fn main() {} diff --git a/src/test/parse-fail/trait-pub-method.rs b/src/test/parse-fail/trait-pub-method.rs index e76802d2ea0..7cb9363830c 100644 --- a/src/test/parse-fail/trait-pub-method.rs +++ b/src/test/parse-fail/trait-pub-method.rs @@ -9,7 +9,8 @@ // except according to those terms. trait Foo { - pub fn foo(); //~ ERROR expected one of `extern`, `fn`, `type`, or `unsafe`, found `pub` + pub fn foo(); + //~^ ERROR expected one of `const`, `extern`, `fn`, `type`, or `unsafe`, found `pub` } fn main() {} -- cgit 1.4.1-3-g733a5