diff options
| author | bors <bors@rust-lang.org> | 2014-02-13 16:32:01 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-02-13 16:32:01 -0800 |
| commit | 89b1686bd7db25b5dd948b1a4d9dfd0c68084c29 (patch) | |
| tree | cfde530d295ebf159fc538115565d5ce1409bea3 /src/test | |
| parent | 94d453e459107ed1c5d76f693686b29d31cdc58c (diff) | |
| parent | 5deb3c9ca06509ce261f69fd01426825e32d61c1 (diff) | |
auto merge of #12017 : FlaPer87/rust/replace-mod-crate, r=alexcrichton
The first setp for #9880 is to add a new `crate` keyword. This PR does exactly that. I took a chance to refactor `parse_item_foreign_mod` and I broke it down into 2 separate methods to isolate each feature. The next step will be to push a new stage0 snapshot and then get rid of all `extern mod` around the code.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail/extern-expected-fn-or-brace.rs | 14 | ||||
| -rw-r--r-- | src/test/compile-fail/extern-foreign-crate.rs | 14 | ||||
| -rw-r--r-- | src/test/compile-fail/obsolete-syntax.rs | 5 | ||||
| -rw-r--r-- | src/test/run-pass/extern-foreign-crate.rs | 14 |
4 files changed, 42 insertions, 5 deletions
diff --git a/src/test/compile-fail/extern-expected-fn-or-brace.rs b/src/test/compile-fail/extern-expected-fn-or-brace.rs new file mode 100644 index 00000000000..638253f816a --- /dev/null +++ b/src/test/compile-fail/extern-expected-fn-or-brace.rs @@ -0,0 +1,14 @@ +// Copyright 2014 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. + +// Verifies that the expected token errors for `extern crate` are +// raised + +extern "C" mod foo; //~ERROR expected `{` or `fn` but found `mod` diff --git a/src/test/compile-fail/extern-foreign-crate.rs b/src/test/compile-fail/extern-foreign-crate.rs new file mode 100644 index 00000000000..ffa6ffb042f --- /dev/null +++ b/src/test/compile-fail/extern-foreign-crate.rs @@ -0,0 +1,14 @@ +// Copyright 2014 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. + +// Verifies that the expected token errors for `extern crate` are +// raised + +extern crate foo {} //~ERROR expected one of `=`, `;` but found `{` diff --git a/src/test/compile-fail/obsolete-syntax.rs b/src/test/compile-fail/obsolete-syntax.rs index 07fa5077d9b..9fe5e2031bb 100644 --- a/src/test/compile-fail/obsolete-syntax.rs +++ b/src/test/compile-fail/obsolete-syntax.rs @@ -8,11 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern mod obsolete_name { - //~^ ERROR obsolete syntax: named external module - fn bar(); -} - trait A { pub fn foo(); //~ ERROR: visibility not necessary pub fn bar(); //~ ERROR: visibility not necessary diff --git a/src/test/run-pass/extern-foreign-crate.rs b/src/test/run-pass/extern-foreign-crate.rs new file mode 100644 index 00000000000..8949734b80e --- /dev/null +++ b/src/test/run-pass/extern-foreign-crate.rs @@ -0,0 +1,14 @@ +// 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. + +extern crate extra; +extern mod mystd = "std"; + +pub fn main() {} |
