parent
50481f5503
commit
4b9bc2e8f2
17 changed files with 268 additions and 80 deletions
19
src/test/compile-fail/use-mod-2.rs
Normal file
19
src/test/compile-fail/use-mod-2.rs
Normal file
|
|
@ -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() {}
|
||||
24
src/test/compile-fail/use-mod-3.rs
Normal file
24
src/test/compile-fail/use-mod-3.rs
Normal file
|
|
@ -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() {}
|
||||
32
src/test/compile-fail/use-mod.rs
Normal file
32
src/test/compile-fail/use-mod.rs
Normal file
|
|
@ -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() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue