]> git.proxmox.com Git - rustc.git/blob - src/test/compile-fail/extern-crate-visibility.rs
Imported Upstream version 1.9.0+dfsg1
[rustc.git] / src / test / compile-fail / extern-crate-visibility.rs
1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 #![feature(rustc_attrs)]
12 #![allow(dead_code)]
13 #![allow(unused_imports)]
14
15 mod foo {
16 extern crate core;
17 }
18
19 // Check that private crates can be used from outside their modules, albeit with warnings
20 use foo::core; //~ WARN extern crate `core` is private
21 //~^ WARN this was previously accepted by the compiler but is being phased out
22 use foo::core::cell; //~ WARN extern crate `core` is private
23 //~^ WARN this was previously accepted by the compiler but is being phased out
24
25 fn f() {
26 foo::core::cell::Cell::new(0); //~ WARN extern crate `core` is private
27 //~^ WARN this was previously accepted by the compiler but is being phased out
28
29 use foo::*;
30 mod core {} // Check that private crates are not glob imported
31 }
32
33 mod bar {
34 pub extern crate core;
35 }
36
37 mod baz {
38 pub use bar::*;
39 use self::core::cell; // Check that public extern crates are glob imported
40 }
41
42 #[rustc_error]
43 fn main() {} //~ ERROR compilation successful