]> git.lizzy.rs Git - rust.git/blob - src/test/ui/unnecessary-extern-crate.rs
Auto merge of #75936 - sdroege:chunks-exact-construction-bounds-check, r=nagisa
[rust.git] / src / test / ui / unnecessary-extern-crate.rs
1 // edition:2018
2
3 #![deny(unused_extern_crates)]
4 #![feature(test, rustc_private, crate_visibility_modifier)]
5
6 extern crate libc;
7 //~^ ERROR unused extern crate
8 //~| HELP remove
9 extern crate libc as x;
10 //~^ ERROR unused extern crate
11 //~| HELP remove
12
13 extern crate proc_macro;
14
15 #[macro_use]
16 extern crate test;
17
18 pub extern crate test as y;
19
20 pub extern crate alloc;
21
22 pub(crate) extern crate alloc as a;
23
24 crate extern crate alloc as b;
25
26 mod foo {
27     pub(in crate::foo) extern crate alloc as c;
28
29     pub(super) extern crate alloc as d;
30
31     extern crate libc;
32     //~^ ERROR unused extern crate
33     //~| HELP remove
34
35     extern crate libc as x;
36     //~^ ERROR unused extern crate
37     //~| HELP remove
38
39     pub extern crate test;
40
41     pub extern crate test as y;
42
43     mod bar {
44         extern crate libc;
45         //~^ ERROR unused extern crate
46         //~| HELP remove
47
48         extern crate libc as x;
49         //~^ ERROR unused extern crate
50         //~| HELP remove
51
52         pub(in crate::foo::bar) extern crate alloc as e;
53
54         fn dummy() {
55             e::string::String::new();
56         }
57     }
58
59     fn dummy() {
60         c::string::String::new();
61         d::string::String::new();
62     }
63 }
64
65
66 fn main() {
67     a::string::String::new();
68     b::string::String::new();
69
70     proc_macro::TokenStream::new();
71 }