diff options
| author | Flavio Percoco <flaper87@gmail.com> | 2014-02-02 23:52:06 +0100 |
|---|---|---|
| committer | Flavio Percoco <flaper87@gmail.com> | 2014-02-13 20:52:16 +0100 |
| commit | 9a6d92c1d706af14da336892e8d5148c3d3859ee (patch) | |
| tree | 83d1384905d7086cf92a78fb6a8d5e9af9b102e0 /src/test | |
| parent | 968633b60ad7f2fd0c5663e92b06f2c9d21964a8 (diff) | |
Replace `extern mod` with `extern crate`
This patch adds a new keyword `crate` which is intended to replace mod in the context of `extern mod` as part of the issue #9880. The patch doesn't replace all `extern mod` cases since it is necessary to first push a new snapshot 0. The implementation could've been less invasive than this. However I preferred to take this chance to split the `parse_item_foreign_mod` method and pull the `extern crate` part out of there, hence the new method `parse_item_foreign_crate`.
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/run-pass/extern-foreign-crate.rs | 14 |
3 files changed, 42 insertions, 0 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/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() {} |
