Skip to content

Commit 01791de

Browse files
committed
Add test
1 parent dafbdeb commit 01791de

File tree

2 files changed

+123
-0
lines changed

2 files changed

+123
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Copyright 2015 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+
#![deny(unnecessary_extern_crate)]
12+
#![feature(alloc, test, libc)]
13+
14+
extern crate alloc;
15+
//~^ ERROR `extern crate` is unnecessary in the new edition
16+
//~| HELP remove
17+
extern crate alloc as x;
18+
//~^ ERROR `extern crate` is unnecessary in the new edition
19+
//~| HELP use `use`
20+
21+
#[macro_use]
22+
extern crate test;
23+
pub extern crate test as y;
24+
//~^ ERROR `extern crate` is unnecessary in the new edition
25+
//~| HELP use `pub use`
26+
pub extern crate libc;
27+
//~^ ERROR `extern crate` is unnecessary in the new edition
28+
//~| HELP use `pub use`
29+
30+
31+
mod foo {
32+
extern crate alloc;
33+
//~^ ERROR `extern crate` is unnecessary in the new edition
34+
//~| HELP use `use`
35+
extern crate alloc as x;
36+
//~^ ERROR `extern crate` is unnecessary in the new edition
37+
//~| HELP use `use`
38+
pub extern crate test;
39+
//~^ ERROR `extern crate` is unnecessary in the new edition
40+
//~| HELP use `pub use`
41+
pub extern crate test as y;
42+
//~^ ERROR `extern crate` is unnecessary in the new edition
43+
//~| HELP use `pub use`
44+
mod bar {
45+
extern crate alloc;
46+
//~^ ERROR `extern crate` is unnecessary in the new edition
47+
//~| HELP use `use`
48+
extern crate alloc as x;
49+
//~^ ERROR `extern crate` is unnecessary in the new edition
50+
//~| HELP use `use`
51+
}
52+
}
53+
54+
55+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
error: `extern crate` is unnecessary in the new edition
2+
--> $DIR/unnecessary-extern-crate.rs:14:1
3+
|
4+
LL | extern crate alloc;
5+
| ^^^^^^^^^^^^^^^^^^^ help: remove it
6+
|
7+
note: lint level defined here
8+
--> $DIR/unnecessary-extern-crate.rs:11:9
9+
|
10+
LL | #![deny(unnecessary_extern_crate)]
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^
12+
13+
error: `extern crate` is unnecessary in the new edition
14+
--> $DIR/unnecessary-extern-crate.rs:17:1
15+
|
16+
LL | extern crate alloc as x;
17+
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc as x`
18+
19+
error: `extern crate` is unnecessary in the new edition
20+
--> $DIR/unnecessary-extern-crate.rs:23:1
21+
|
22+
LL | pub extern crate test as y;
23+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `pub use`: `pub use test as y`
24+
25+
error: `extern crate` is unnecessary in the new edition
26+
--> $DIR/unnecessary-extern-crate.rs:26:1
27+
|
28+
LL | pub extern crate libc;
29+
| ^^^^^^^^^^^^^^^^^^^^^^ help: use `pub use`: `pub use libc`
30+
31+
error: `extern crate` is unnecessary in the new edition
32+
--> $DIR/unnecessary-extern-crate.rs:32:5
33+
|
34+
LL | extern crate alloc;
35+
| ^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc`
36+
37+
error: `extern crate` is unnecessary in the new edition
38+
--> $DIR/unnecessary-extern-crate.rs:35:5
39+
|
40+
LL | extern crate alloc as x;
41+
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc as x`
42+
43+
error: `extern crate` is unnecessary in the new edition
44+
--> $DIR/unnecessary-extern-crate.rs:38:5
45+
|
46+
LL | pub extern crate test;
47+
| ^^^^^^^^^^^^^^^^^^^^^^ help: use `pub use`: `pub use test`
48+
49+
error: `extern crate` is unnecessary in the new edition
50+
--> $DIR/unnecessary-extern-crate.rs:41:5
51+
|
52+
LL | pub extern crate test as y;
53+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `pub use`: `pub use test as y`
54+
55+
error: `extern crate` is unnecessary in the new edition
56+
--> $DIR/unnecessary-extern-crate.rs:45:9
57+
|
58+
LL | extern crate alloc;
59+
| ^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc`
60+
61+
error: `extern crate` is unnecessary in the new edition
62+
--> $DIR/unnecessary-extern-crate.rs:48:9
63+
|
64+
LL | extern crate alloc as x;
65+
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc as x`
66+
67+
error: aborting due to 10 previous errors
68+

0 commit comments

Comments
 (0)