mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-16 13:05:18 +03:00
tests: use alloc instead of libc in unnecessary-extern-crate, to make it work on wasm.
This commit is contained in:
@@ -13,10 +13,10 @@
|
||||
#![deny(unused_extern_crates)]
|
||||
#![feature(alloc, test, libc, crate_visibility_modifier)]
|
||||
|
||||
extern crate alloc;
|
||||
extern crate libc;
|
||||
//~^ ERROR unused extern crate
|
||||
//~| HELP remove
|
||||
extern crate alloc as x;
|
||||
extern crate libc as x;
|
||||
//~^ ERROR unused extern crate
|
||||
//~| HELP remove
|
||||
|
||||
@@ -27,22 +27,22 @@
|
||||
|
||||
pub extern crate test as y;
|
||||
|
||||
pub extern crate libc;
|
||||
pub extern crate alloc;
|
||||
|
||||
pub(crate) extern crate libc as a;
|
||||
pub(crate) extern crate alloc as a;
|
||||
|
||||
crate extern crate libc as b;
|
||||
crate extern crate alloc as b;
|
||||
|
||||
mod foo {
|
||||
pub(in crate::foo) extern crate libc as c;
|
||||
pub(in crate::foo) extern crate alloc as c;
|
||||
|
||||
pub(super) extern crate libc as d;
|
||||
pub(super) extern crate alloc as d;
|
||||
|
||||
extern crate alloc;
|
||||
extern crate libc;
|
||||
//~^ ERROR unused extern crate
|
||||
//~| HELP remove
|
||||
|
||||
extern crate alloc as x;
|
||||
extern crate libc as x;
|
||||
//~^ ERROR unused extern crate
|
||||
//~| HELP remove
|
||||
|
||||
@@ -51,35 +51,31 @@ mod foo {
|
||||
pub extern crate test as y;
|
||||
|
||||
mod bar {
|
||||
extern crate alloc;
|
||||
extern crate libc;
|
||||
//~^ ERROR unused extern crate
|
||||
//~| HELP remove
|
||||
|
||||
extern crate alloc as x;
|
||||
extern crate libc as x;
|
||||
//~^ ERROR unused extern crate
|
||||
//~| HELP remove
|
||||
|
||||
pub(in crate::foo::bar) extern crate libc as e;
|
||||
pub(in crate::foo::bar) extern crate alloc as e;
|
||||
|
||||
fn dummy() {
|
||||
unsafe {
|
||||
e::getpid();
|
||||
}
|
||||
e::string::String::new();
|
||||
}
|
||||
}
|
||||
|
||||
fn dummy() {
|
||||
unsafe {
|
||||
c::getpid();
|
||||
d::getpid();
|
||||
}
|
||||
c::string::String::new();
|
||||
d::string::String::new();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fn main() {
|
||||
unsafe { a::getpid(); }
|
||||
unsafe { b::getpid(); }
|
||||
a::string::String::new();
|
||||
b::string::String::new();
|
||||
|
||||
proc_macro::TokenStream::new();
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
error: unused extern crate
|
||||
--> $DIR/unnecessary-extern-crate.rs:16:1
|
||||
|
|
||||
LL | extern crate alloc;
|
||||
| ^^^^^^^^^^^^^^^^^^^ help: remove it
|
||||
LL | extern crate libc;
|
||||
| ^^^^^^^^^^^^^^^^^^ help: remove it
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/unnecessary-extern-crate.rs:13:9
|
||||
@@ -13,32 +13,32 @@ LL | #![deny(unused_extern_crates)]
|
||||
error: unused extern crate
|
||||
--> $DIR/unnecessary-extern-crate.rs:19:1
|
||||
|
|
||||
LL | extern crate alloc as x;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
|
||||
LL | extern crate libc as x;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
|
||||
|
||||
error: unused extern crate
|
||||
--> $DIR/unnecessary-extern-crate.rs:41:5
|
||||
|
|
||||
LL | extern crate alloc;
|
||||
| ^^^^^^^^^^^^^^^^^^^ help: remove it
|
||||
LL | extern crate libc;
|
||||
| ^^^^^^^^^^^^^^^^^^ help: remove it
|
||||
|
||||
error: unused extern crate
|
||||
--> $DIR/unnecessary-extern-crate.rs:45:5
|
||||
|
|
||||
LL | extern crate alloc as x;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
|
||||
LL | extern crate libc as x;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
|
||||
|
||||
error: unused extern crate
|
||||
--> $DIR/unnecessary-extern-crate.rs:54:9
|
||||
|
|
||||
LL | extern crate alloc;
|
||||
| ^^^^^^^^^^^^^^^^^^^ help: remove it
|
||||
LL | extern crate libc;
|
||||
| ^^^^^^^^^^^^^^^^^^ help: remove it
|
||||
|
||||
error: unused extern crate
|
||||
--> $DIR/unnecessary-extern-crate.rs:58:9
|
||||
|
|
||||
LL | extern crate alloc as x;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
|
||||
LL | extern crate libc as x;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
||||
Reference in New Issue
Block a user