Skip to content

Commit 7457a0d

Browse files
committed
Use the rustc_private libc less in tests
1 parent 9782770 commit 7457a0d

25 files changed

+88
-125
lines changed

Diff for: tests/ui-fulldeps/regions-mock-tcx.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
// - Multiple lifetime parameters
1010
// - Arenas
1111

12-
#![feature(rustc_private, libc)]
12+
#![feature(rustc_private)]
1313

1414
extern crate rustc_arena;
15-
extern crate libc;
1615

1716
// Necessary to pull in object code as the rest of the rustc crates are shipped only as rmeta
1817
// files.

Diff for: tests/ui/abi/c-stack-returning-int64.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
//@ run-pass
22
//@ ignore-sgx no libc
33

4-
#![feature(rustc_private)]
5-
6-
extern crate libc;
7-
84
use std::ffi::CString;
95

106
mod mlibc {
11-
use libc::{c_char, c_long, c_longlong};
7+
use std::ffi::{c_char, c_long, c_longlong};
128

139
extern "C" {
1410
pub fn atol(x: *const c_char) -> c_long;

Diff for: tests/ui/abi/statics/static-mut-foreign.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,17 @@
33
// statics cannot. This ensures that there's some form of error if this is
44
// attempted.
55

6-
#![feature(rustc_private)]
7-
8-
extern crate libc;
6+
use std::ffi::c_int;
97

108
#[link(name = "rust_test_helpers", kind = "static")]
119
extern "C" {
12-
static mut rust_dbg_static_mut: libc::c_int;
10+
static mut rust_dbg_static_mut: c_int;
1311
pub fn rust_dbg_static_mut_check_four();
1412
}
1513

16-
unsafe fn static_bound(_: &'static libc::c_int) {}
14+
unsafe fn static_bound(_: &'static c_int) {}
1715

18-
fn static_bound_set(a: &'static mut libc::c_int) {
16+
fn static_bound_set(a: &'static mut c_int) {
1917
*a = 3;
2018
}
2119

Diff for: tests/ui/abi/statics/static-mut-foreign.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: creating a shared reference to mutable static is discouraged
2-
--> $DIR/static-mut-foreign.rs:33:18
2+
--> $DIR/static-mut-foreign.rs:31:18
33
|
44
LL | static_bound(&rust_dbg_static_mut);
55
| ^^^^^^^^^^^^^^^^^^^^ shared reference to mutable static
@@ -14,7 +14,7 @@ LL | static_bound(addr_of!(rust_dbg_static_mut));
1414
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1515

1616
warning: creating a mutable reference to mutable static is discouraged
17-
--> $DIR/static-mut-foreign.rs:35:22
17+
--> $DIR/static-mut-foreign.rs:33:22
1818
|
1919
LL | static_bound_set(&mut rust_dbg_static_mut);
2020
| ^^^^^^^^^^^^^^^^^^^^^^^^ mutable reference to mutable static

Diff for: tests/ui/array-slice-vec/vec-macro-no-std.rs

-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
extern crate std as other;
99

10-
extern crate libc;
11-
1210
#[macro_use]
1311
extern crate alloc;
1412

Diff for: tests/ui/auxiliary/check_static_recursion_foreign_helper.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#![crate_name = "check_static_recursion_foreign_helper"]
66
#![crate_type = "lib"]
77

8-
extern crate libc;
8+
use std::ffi::c_int;
99

1010
#[no_mangle]
11-
pub static test_static: libc::c_int = 0;
11+
pub static test_static: c_int = 0;

Diff for: tests/ui/check-static-recursion-foreign.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,9 @@
66

77
//@ pretty-expanded FIXME #23616
88

9-
#![feature(rustc_private)]
10-
119
extern crate check_static_recursion_foreign_helper;
12-
extern crate libc;
1310

14-
use libc::c_int;
11+
use std::ffi::c_int;
1512

1613
extern "C" {
1714
static test_static: c_int;

Diff for: tests/ui/extern/extern-const.fixed

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
//@ run-rustfix
88
//@ compile-flags: -g
9-
#![feature(rustc_private)]
10-
extern crate libc;
9+
10+
use std::ffi::c_int;
1111

1212
#[link(name = "rust_test_helpers", kind = "static")]
1313
extern "C" {
14-
static rust_dbg_static_mut: libc::c_int; //~ ERROR extern items cannot be `const`
14+
static rust_dbg_static_mut: c_int; //~ ERROR extern items cannot be `const`
1515
}
1616

1717
fn main() {

Diff for: tests/ui/extern/extern-const.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
//@ run-rustfix
88
//@ compile-flags: -g
9-
#![feature(rustc_private)]
10-
extern crate libc;
9+
10+
use std::ffi::c_int;
1111

1212
#[link(name = "rust_test_helpers", kind = "static")]
1313
extern "C" {
14-
const rust_dbg_static_mut: libc::c_int; //~ ERROR extern items cannot be `const`
14+
const rust_dbg_static_mut: c_int; //~ ERROR extern items cannot be `const`
1515
}
1616

1717
fn main() {

Diff for: tests/ui/extern/extern-const.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error: extern items cannot be `const`
22
--> $DIR/extern-const.rs:14:11
33
|
4-
LL | const rust_dbg_static_mut: libc::c_int;
4+
LL | const rust_dbg_static_mut: c_int;
55
| ------^^^^^^^^^^^^^^^^^^^
66
| |
77
| help: try using a static value: `static`

Diff for: tests/ui/internal-lints/existing_doc_keyword.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//@ compile-flags: -Z unstable-options
22

3-
#![feature(rustc_private)]
43
#![feature(rustdoc_internals)]
54

65
#![crate_type = "lib"]

Diff for: tests/ui/internal-lints/existing_doc_keyword.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
error: found non-existing keyword `tadam` used in `#[doc(keyword = "...")]`
2-
--> $DIR/existing_doc_keyword.rs:10:1
2+
--> $DIR/existing_doc_keyword.rs:9:1
33
|
44
LL | #[doc(keyword = "tadam")]
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= help: only existing keywords are allowed in core/std
88
note: the lint level is defined here
9-
--> $DIR/existing_doc_keyword.rs:8:9
9+
--> $DIR/existing_doc_keyword.rs:7:9
1010
|
1111
LL | #![deny(rustc::existing_doc_keyword)]
1212
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^

Diff for: tests/ui/issues/issue-13259-windows-tcb-trash.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
//@ run-pass
2-
#![feature(rustc_private)]
3-
4-
extern crate libc;
52

63
#[cfg(windows)]
74
mod imp {

Diff for: tests/ui/issues/issue-22034.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
#![feature(rustc_private)]
2-
3-
extern crate libc;
4-
51
fn main() {
62
let ptr: *mut () = core::ptr::null_mut();
73
let _: &mut dyn Fn() = unsafe {

Diff for: tests/ui/issues/issue-22034.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0277]: expected a `Fn()` closure, found `()`
2-
--> $DIR/issue-22034.rs:8:16
2+
--> $DIR/issue-22034.rs:4:16
33
|
44
LL | &mut *(ptr as *mut dyn Fn())
55
| ^^^ expected an `Fn()` closure, found `()`

Diff for: tests/ui/issues/issue-2214.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
//@ run-pass
22
//@ ignore-wasm32 wasi-libc does not have lgamma
33
//@ ignore-sgx no libc
4-
#![feature(rustc_private)]
54

6-
extern crate libc;
7-
8-
use libc::{c_double, c_int};
5+
use std::ffi::{c_double, c_int};
96
use std::mem;
107

118
fn to_c_int(v: &mut isize) -> &mut c_int {
@@ -19,8 +16,7 @@ fn lgamma(n: c_double, value: &mut isize) -> c_double {
1916
}
2017

2118
mod m {
22-
use libc::{c_double, c_int};
23-
19+
use std::ffi::{c_double, c_int};
2420
extern "C" {
2521
#[cfg(all(unix, not(target_os = "vxworks")))]
2622
#[link_name="lgamma_r"]

Diff for: tests/ui/issues/issue-3656.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@
66
// the alignment of elements into account.
77

88
//@ pretty-expanded FIXME #23616
9-
#![feature(rustc_private)]
109

11-
extern crate libc;
12-
use libc::{c_uint, c_void};
10+
use std::ffi::{c_uint, c_void};
1311

1412
pub struct KEYGEN {
1513
hash_algorithm: [c_uint; 2],

Diff for: tests/ui/lint/lint-ctypes-fn.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
#![feature(rustc_private)]
2-
31
#![allow(private_interfaces)]
42
#![deny(improper_ctypes_definitions)]
53

6-
extern crate libc;
7-
84
use std::default::Default;
95
use std::marker::PhantomData;
6+
use std::ffi::{c_int, c_uint};
107

118
trait Trait {}
129

@@ -165,10 +162,10 @@ pub extern "C" fn good17(p: TransparentCustomZst) { }
165162
pub extern "C" fn good18(_: &String) { }
166163

167164
#[cfg(not(target_arch = "wasm32"))]
168-
pub extern "C" fn good1(size: *const libc::c_int) { }
165+
pub extern "C" fn good1(size: *const c_int) { }
169166

170167
#[cfg(not(target_arch = "wasm32"))]
171-
pub extern "C" fn good2(size: *const libc::c_uint) { }
168+
pub extern "C" fn good2(size: *const c_uint) { }
172169

173170
pub extern "C" fn unused_generic1<T>(size: *const Foo) { }
174171

0 commit comments

Comments
 (0)