about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEduard-Mihai Burtescu <edy.burt@gmail.com>2018-11-26 16:28:42 +0200
committerEduard-Mihai Burtescu <edy.burt@gmail.com>2018-11-30 06:15:20 +0200
commitdcf736d7adafc722b2f548cd033f974469543821 (patch)
tree8fa871483a61cc1169030772d62a660704a25b85 /src
parentf385589dde6f39ec1deedceacd05f554d625fd50 (diff)
downloadrust-dcf736d7adafc722b2f548cd033f974469543821.tar.gz
rust-dcf736d7adafc722b2f548cd033f974469543821.zip
tests: use alloc instead of libc in unnecessary-extern-crate, to make it work on wasm.
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/unnecessary-extern-crate.rs38
-rw-r--r--src/test/ui/unnecessary-extern-crate.stderr24
2 files changed, 29 insertions, 33 deletions
diff --git a/src/test/ui/unnecessary-extern-crate.rs b/src/test/ui/unnecessary-extern-crate.rs
index 1cdc9229d07..110cfefcd92 100644
--- a/src/test/ui/unnecessary-extern-crate.rs
+++ b/src/test/ui/unnecessary-extern-crate.rs
@@ -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 @@ extern crate test;
 
 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();
 }
diff --git a/src/test/ui/unnecessary-extern-crate.stderr b/src/test/ui/unnecessary-extern-crate.stderr
index 58ec5901585..1315bff791d 100644
--- a/src/test/ui/unnecessary-extern-crate.stderr
+++ b/src/test/ui/unnecessary-extern-crate.stderr
@@ -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