diff options
| author | Jakub Wieczorek <jakub@jakub.cc> | 2014-07-18 00:56:56 +0200 |
|---|---|---|
| committer | Jakub Wieczorek <jakub@jakub.cc> | 2014-07-20 12:40:08 +0200 |
| commit | 4b9bc2e8f268dfe2a2462c4e378e5a0eeefa2cf4 (patch) | |
| tree | ada16b620d93f1ae709185df0986c58a62614e8d /src/test/compile-fail | |
| parent | 50481f55030f02543e1b3b6ae008d77b1cef3e98 (diff) | |
| download | rust-4b9bc2e8f268dfe2a2462c4e378e5a0eeefa2cf4.tar.gz rust-4b9bc2e8f268dfe2a2462c4e378e5a0eeefa2cf4.zip | |
Implement new mod import sugar
Implements RFC #168.
Diffstat (limited to 'src/test/compile-fail')
| -rw-r--r-- | src/test/compile-fail/use-mod-2.rs | 19 | ||||
| -rw-r--r-- | src/test/compile-fail/use-mod-3.rs | 24 | ||||
| -rw-r--r-- | src/test/compile-fail/use-mod.rs | 32 |
3 files changed, 75 insertions, 0 deletions
diff --git a/src/test/compile-fail/use-mod-2.rs b/src/test/compile-fail/use-mod-2.rs new file mode 100644 index 00000000000..12d4531078d --- /dev/null +++ b/src/test/compile-fail/use-mod-2.rs @@ -0,0 +1,19 @@ +// 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. + +mod foo { + use self::{mod}; + //~^ ERROR unresolved import `self`. There is no `self` in `???` + + use super::{mod}; + //~^ ERROR unresolved import `super`. There is no `super` in `???` +} + +fn main() {} diff --git a/src/test/compile-fail/use-mod-3.rs b/src/test/compile-fail/use-mod-3.rs new file mode 100644 index 00000000000..0263dc392f1 --- /dev/null +++ b/src/test/compile-fail/use-mod-3.rs @@ -0,0 +1,24 @@ +// 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. + +use foo::bar::{ + mod //~ ERROR module `bar` is private +}; +use foo::bar::{ + Bar, //~ ERROR type `Bar` is inaccessible + //~^ NOTE module `bar` is private + mod //~ ERROR module `bar` is private +}; + +mod foo { + mod bar { pub type Bar = int; } +} + +fn main() {} diff --git a/src/test/compile-fail/use-mod.rs b/src/test/compile-fail/use-mod.rs new file mode 100644 index 00000000000..b2b0eb21ace --- /dev/null +++ b/src/test/compile-fail/use-mod.rs @@ -0,0 +1,32 @@ +// 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. + +use foo::bar::{ + mod, +//~^ ERROR `mod` import can only appear once in the list + Bar, + mod +//~^ NOTE another `mod` import appears here +}; + +use {mod}; +//~^ ERROR `mod` import can only appear in an import list with a non-empty prefix + +use foo::mod; +//~^ ERROR `mod` imports are only allowed within a { } list + +mod foo { + pub mod bar { + pub struct Bar; + pub struct Baz; + } +} + +fn main() {} |
