Skip to content

Commit df9dd1c

Browse files
committed
Handle a few more simple tests
1 parent 2516f8e commit df9dd1c

9 files changed

+34
-32
lines changed

tests/ui/error-codes/E0259.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#![feature(rustc_private)]
1+
#![feature(test)]
22

33
extern crate alloc;
44

5-
extern crate libc as alloc;
5+
extern crate test as alloc;
66
//~^ ERROR E0259
77

88
fn main() {}

tests/ui/error-codes/E0259.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ error[E0259]: the name `alloc` is defined multiple times
44
LL | extern crate alloc;
55
| ------------------- previous import of the extern crate `alloc` here
66
LL |
7-
LL | extern crate libc as alloc;
7+
LL | extern crate test as alloc;
88
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `alloc` reimported here
99
|
1010
= note: `alloc` must be defined only once in the type namespace of this module
1111
help: you can use `as` to change the binding name of the import
1212
|
13-
LL | extern crate libc as other_alloc;
13+
LL | extern crate test as other_alloc;
1414
|
1515

1616
error: aborting due to 1 previous error

tests/ui/imports/issue-37887.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
fn main() {
2-
extern crate libc; //~ ERROR use of unstable
3-
use libc::*; //~ ERROR unresolved import
2+
extern crate test; //~ ERROR use of unstable
3+
use test::*; //~ ERROR unresolved import
44
}

tests/ui/imports/issue-37887.stderr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
error[E0432]: unresolved import `libc`
1+
error[E0432]: unresolved import `test`
22
--> $DIR/issue-37887.rs:3:9
33
|
4-
LL | use libc::*;
5-
| ^^^^ maybe a missing crate `libc`?
4+
LL | use test::*;
5+
| ^^^^ maybe a missing crate `test`?
66
|
7-
= help: consider adding `extern crate libc` to use the `libc` crate
7+
= help: consider adding `extern crate test` to use the `test` crate
88

9-
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
9+
error[E0658]: use of unstable library feature 'test'
1010
--> $DIR/issue-37887.rs:2:5
1111
|
12-
LL | extern crate libc;
12+
LL | extern crate test;
1313
| ^^^^^^^^^^^^^^^^^^
1414
|
15-
= note: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
16-
= help: add `#![feature(rustc_private)]` to the crate attributes to enable
15+
= note: see issue #50297 <https://github.com/rust-lang/rust/issues/50297> for more information
16+
= help: add `#![feature(test)]` to the crate attributes to enable
1717
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1818

1919
error: aborting due to 2 previous errors

tests/ui/lint/unnecessary-extern-crate.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
//@ edition:2018
22

33
#![deny(unused_extern_crates)]
4-
#![feature(test, rustc_private)]
4+
#![feature(test)]
55

6-
extern crate libc;
6+
extern crate core;
77
//~^ ERROR unused extern crate
88
//~| HELP remove
9-
extern crate libc as x;
9+
extern crate core as x;
1010
//~^ ERROR unused extern crate
1111
//~| HELP remove
1212

@@ -28,11 +28,11 @@ mod foo {
2828

2929
pub(super) extern crate alloc as d;
3030

31-
extern crate libc;
31+
extern crate core;
3232
//~^ ERROR unused extern crate
3333
//~| HELP remove
3434

35-
extern crate libc as x;
35+
extern crate core as x;
3636
//~^ ERROR unused extern crate
3737
//~| HELP remove
3838

@@ -41,11 +41,11 @@ mod foo {
4141
pub extern crate test as y;
4242

4343
mod bar {
44-
extern crate libc;
44+
extern crate core;
4545
//~^ ERROR unused extern crate
4646
//~| HELP remove
4747

48-
extern crate libc as x;
48+
extern crate core as x;
4949
//~^ ERROR unused extern crate
5050
//~| HELP remove
5151

tests/ui/lint/unnecessary-extern-crate.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error: unused extern crate
22
--> $DIR/unnecessary-extern-crate.rs:6:1
33
|
4-
LL | extern crate libc;
4+
LL | extern crate core;
55
| ^^^^^^^^^^^^^^^^^^ help: remove it
66
|
77
note: the lint level is defined here
@@ -13,31 +13,31 @@ LL | #![deny(unused_extern_crates)]
1313
error: unused extern crate
1414
--> $DIR/unnecessary-extern-crate.rs:9:1
1515
|
16-
LL | extern crate libc as x;
16+
LL | extern crate core as x;
1717
| ^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
1818

1919
error: unused extern crate
2020
--> $DIR/unnecessary-extern-crate.rs:31:5
2121
|
22-
LL | extern crate libc;
22+
LL | extern crate core;
2323
| ^^^^^^^^^^^^^^^^^^ help: remove it
2424

2525
error: unused extern crate
2626
--> $DIR/unnecessary-extern-crate.rs:35:5
2727
|
28-
LL | extern crate libc as x;
28+
LL | extern crate core as x;
2929
| ^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
3030

3131
error: unused extern crate
3232
--> $DIR/unnecessary-extern-crate.rs:44:9
3333
|
34-
LL | extern crate libc;
34+
LL | extern crate core;
3535
| ^^^^^^^^^^^^^^^^^^ help: remove it
3636

3737
error: unused extern crate
3838
--> $DIR/unnecessary-extern-crate.rs:48:9
3939
|
40-
LL | extern crate libc as x;
40+
LL | extern crate core as x;
4141
| ^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
4242

4343
error: aborting due to 6 previous errors

tests/ui/meta/no_std-extern-libc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Test that `download-rustc` doesn't put duplicate copies of libc in the sysroot.
22
//@ check-pass
3+
//@ ignore-windows doesn't necessarily have the libc crate
34
#![crate_type = "lib"]
45
#![no_std]
56
#![feature(rustc_private)]

tests/ui/process/no-stdio.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55

66
#![feature(rustc_private)]
77

8+
#[cfg(unix)]
89
extern crate libc;
910

10-
use std::process::{Command, Stdio};
1111
use std::env;
12+
use std::ffi::c_int;
1213
use std::io::{self, Read, Write};
14+
use std::process::{Command, Stdio};
1315

1416
#[cfg(unix)]
1517
unsafe fn without_stdio<R, F: FnOnce() -> R>(f: F) -> R {
@@ -36,14 +38,14 @@ unsafe fn without_stdio<R, F: FnOnce() -> R>(f: F) -> R {
3638
}
3739

3840
#[cfg(unix)]
39-
fn assert_fd_is_valid(fd: libc::c_int) {
41+
fn assert_fd_is_valid(fd: c_int) {
4042
if unsafe { libc::fcntl(fd, libc::F_GETFD) == -1 } {
4143
panic!("file descriptor {} is not valid: {}", fd, io::Error::last_os_error());
4244
}
4345
}
4446

4547
#[cfg(windows)]
46-
fn assert_fd_is_valid(_fd: libc::c_int) {}
48+
fn assert_fd_is_valid(_fd: c_int) {}
4749

4850
#[cfg(windows)]
4951
unsafe fn without_stdio<R, F: FnOnce() -> R>(f: F) -> R {

tests/ui/wait-forked-but-failed-child.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
#![feature(rustc_private)]
99

10-
extern crate libc;
11-
1210
use std::process::Command;
1311

1412
// The output from "ps -A -o pid,ppid,args" should look like this:
@@ -28,6 +26,7 @@ use std::process::Command;
2826

2927
#[cfg(unix)]
3028
fn find_zombies() {
29+
extern crate libc;
3130
let my_pid = unsafe { libc::getpid() };
3231

3332
// https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ps.html

0 commit comments

Comments
 (0)