Handle a few more simple tests

This commit is contained in:
Ben Kimock 2024-04-18 17:03:17 -04:00
parent e0632d7cec
commit 18b0a07d49
9 changed files with 34 additions and 32 deletions

View File

@ -1,8 +1,8 @@
#![feature(rustc_private)]
#![feature(test)]
extern crate alloc;
extern crate libc as alloc;
extern crate test as alloc;
//~^ ERROR E0259
fn main() {}

View File

@ -4,13 +4,13 @@ error[E0259]: the name `alloc` is defined multiple times
LL | extern crate alloc;
| ------------------- previous import of the extern crate `alloc` here
LL |
LL | extern crate libc as alloc;
LL | extern crate test as alloc;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `alloc` reimported here
|
= note: `alloc` must be defined only once in the type namespace of this module
help: you can use `as` to change the binding name of the import
|
LL | extern crate libc as other_alloc;
LL | extern crate test as other_alloc;
|
error: aborting due to 1 previous error

View File

@ -1,4 +1,4 @@
fn main() {
extern crate libc; //~ ERROR use of unstable
use libc::*; //~ ERROR unresolved import
extern crate test; //~ ERROR use of unstable
use test::*; //~ ERROR unresolved import
}

View File

@ -1,19 +1,19 @@
error[E0432]: unresolved import `libc`
error[E0432]: unresolved import `test`
--> $DIR/issue-37887.rs:3:9
|
LL | use libc::*;
| ^^^^ maybe a missing crate `libc`?
LL | use test::*;
| ^^^^ maybe a missing crate `test`?
|
= help: consider adding `extern crate libc` to use the `libc` crate
= help: consider adding `extern crate test` to use the `test` crate
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?
error[E0658]: use of unstable library feature 'test'
--> $DIR/issue-37887.rs:2:5
|
LL | extern crate libc;
LL | extern crate test;
| ^^^^^^^^^^^^^^^^^^
|
= note: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
= help: add `#![feature(rustc_private)]` to the crate attributes to enable
= note: see issue #50297 <https://github.com/rust-lang/rust/issues/50297> for more information
= help: add `#![feature(test)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 2 previous errors

View File

@ -1,12 +1,12 @@
//@ edition:2018
#![deny(unused_extern_crates)]
#![feature(test, rustc_private)]
#![feature(test)]
extern crate libc;
extern crate core;
//~^ ERROR unused extern crate
//~| HELP remove
extern crate libc as x;
extern crate core as x;
//~^ ERROR unused extern crate
//~| HELP remove
@ -28,11 +28,11 @@ mod foo {
pub(super) extern crate alloc as d;
extern crate libc;
extern crate core;
//~^ ERROR unused extern crate
//~| HELP remove
extern crate libc as x;
extern crate core as x;
//~^ ERROR unused extern crate
//~| HELP remove
@ -41,11 +41,11 @@ mod foo {
pub extern crate test as y;
mod bar {
extern crate libc;
extern crate core;
//~^ ERROR unused extern crate
//~| HELP remove
extern crate libc as x;
extern crate core as x;
//~^ ERROR unused extern crate
//~| HELP remove

View File

@ -1,7 +1,7 @@
error: unused extern crate
--> $DIR/unnecessary-extern-crate.rs:6:1
|
LL | extern crate libc;
LL | extern crate core;
| ^^^^^^^^^^^^^^^^^^ help: remove it
|
note: the lint level is defined here
@ -13,31 +13,31 @@ LL | #![deny(unused_extern_crates)]
error: unused extern crate
--> $DIR/unnecessary-extern-crate.rs:9:1
|
LL | extern crate libc as x;
LL | extern crate core as x;
| ^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
error: unused extern crate
--> $DIR/unnecessary-extern-crate.rs:31:5
|
LL | extern crate libc;
LL | extern crate core;
| ^^^^^^^^^^^^^^^^^^ help: remove it
error: unused extern crate
--> $DIR/unnecessary-extern-crate.rs:35:5
|
LL | extern crate libc as x;
LL | extern crate core as x;
| ^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
error: unused extern crate
--> $DIR/unnecessary-extern-crate.rs:44:9
|
LL | extern crate libc;
LL | extern crate core;
| ^^^^^^^^^^^^^^^^^^ help: remove it
error: unused extern crate
--> $DIR/unnecessary-extern-crate.rs:48:9
|
LL | extern crate libc as x;
LL | extern crate core as x;
| ^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
error: aborting due to 6 previous errors

View File

@ -1,5 +1,6 @@
// Test that `download-rustc` doesn't put duplicate copies of libc in the sysroot.
//@ check-pass
//@ ignore-windows doesn't necessarily have the libc crate
#![crate_type = "lib"]
#![no_std]
#![feature(rustc_private)]

View File

@ -5,11 +5,13 @@
#![feature(rustc_private)]
#[cfg(unix)]
extern crate libc;
use std::process::{Command, Stdio};
use std::env;
use std::ffi::c_int;
use std::io::{self, Read, Write};
use std::process::{Command, Stdio};
#[cfg(unix)]
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 {
}
#[cfg(unix)]
fn assert_fd_is_valid(fd: libc::c_int) {
fn assert_fd_is_valid(fd: c_int) {
if unsafe { libc::fcntl(fd, libc::F_GETFD) == -1 } {
panic!("file descriptor {} is not valid: {}", fd, io::Error::last_os_error());
}
}
#[cfg(windows)]
fn assert_fd_is_valid(_fd: libc::c_int) {}
fn assert_fd_is_valid(_fd: c_int) {}
#[cfg(windows)]
unsafe fn without_stdio<R, F: FnOnce() -> R>(f: F) -> R {

View File

@ -7,8 +7,6 @@
#![feature(rustc_private)]
extern crate libc;
use std::process::Command;
// The output from "ps -A -o pid,ppid,args" should look like this:
@ -28,6 +26,7 @@ use std::process::Command;
#[cfg(unix)]
fn find_zombies() {
extern crate libc;
let my_pid = unsafe { libc::getpid() };
// https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ps.html