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.
This commit is contained in:
commit
89b1686bd7
76 changed files with 618 additions and 590 deletions
14
src/test/compile-fail/extern-expected-fn-or-brace.rs
Normal file
14
src/test/compile-fail/extern-expected-fn-or-brace.rs
Normal file
|
|
@ -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`
|
||||
14
src/test/compile-fail/extern-foreign-crate.rs
Normal file
14
src/test/compile-fail/extern-foreign-crate.rs
Normal file
|
|
@ -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 `{`
|
||||
|
|
@ -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
|
||||
|
|
|
|||
14
src/test/run-pass/extern-foreign-crate.rs
Normal file
14
src/test/run-pass/extern-foreign-crate.rs
Normal file
|
|
@ -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() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue