Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 8 pull requests #74422

Merged
merged 53 commits into from
Jul 17, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
c4b0265
Enable some timeouts in SGX platform
mzohreva Jun 12, 2020
d7dc64b
Handle spurious wakeups in wait_timeout_sgx
mzohreva Jun 12, 2020
c5d1fcd
Allow more ui tests for SGX
mzohreva Jun 12, 2020
3442d23
Improve wait_timeout_sgx, simplify usercalls::wait
mzohreva Jun 18, 2020
c457b67
Remove unnecessary check in SGX wait usercall
mzohreva Jul 1, 2020
1466598
Address review comments
mzohreva Jul 11, 2020
f970632
Don't render unstable for rustc docs
tesuji Jul 15, 2020
47fea96
Remove unused CSS rules for internal rustc items
tesuji Jul 15, 2020
8c6c1dd
Automatically calculate std::env::consts::ARCH.
ehuss May 21, 2020
432b4c1
Use cfg_if in libtest.
ehuss May 22, 2020
9e58908
Use cfg_if in libpanic_abort.
ehuss May 22, 2020
ef6c026
Improve ayu rustdoc theme
Aloso Jul 15, 2020
6e9a1de
Introduce restricted-std feature.
ehuss Jun 1, 2020
cee9f05
Tweak formatting.
ehuss Jul 7, 2020
0eb293d
Use an allow-list of platforms that support std.
ehuss Jul 7, 2020
3d44d3c
Simplify os_str_bytes cfg expression.
ehuss Jul 7, 2020
d08bb40
Remove drop-shadow
Aloso Jul 15, 2020
85c25ae
Move usercall_wait_timeout to abi::usercalls::wait_timeout
mzohreva Jul 15, 2020
1813ae7
Add RISC-V GNU/Linux to src/tools/build-manifest as a host platform
msizanoen1 Jul 16, 2020
03bbe9d
Clean up E0723 explanation
GuillaumeGomez Jul 16, 2020
8e92f4f
Remove unused `cx` parameter from `pathvec_std` and `path_std`.
nnethercote Jul 14, 2020
bccff14
Simplify `LifetimeBounds`.
nnethercote Jul 14, 2020
5271e98
Use get_module instead of `module_map` for `resolve_str_path_error`
jyn514 Jun 6, 2020
848a766
Use the scope of the imported variable for resolution, not the curren…
jyn514 Jun 6, 2020
69bd13f
Use DefId for modules
jyn514 Jun 7, 2020
c3d9a73
Don't panic on fake IDs
jyn514 Jun 7, 2020
20106d5
unwrap() -> expect()
jyn514 Jun 7, 2020
24c3d85
Make sure that module_id is actually a module
jyn514 Jun 7, 2020
9542e23
Add tests for basic intra-doc links
jyn514 Jun 8, 2020
99f34d8
Remove warnings
jyn514 Jun 8, 2020
e78d499
Add test for re-exports
jyn514 Jun 8, 2020
9eb6394
Add test for documenting the re-export
jyn514 Jun 8, 2020
71fe8f7
Add test for submodules in inner crate
jyn514 Jun 10, 2020
432b043
Move import to top of function
jyn514 Jun 10, 2020
769acba
#![deny(intra_doc_resolution_failure)]
jyn514 Jun 10, 2020
5f49f55
rand -> my_rand
jyn514 Jun 10, 2020
e63e5cd
Support intra-doc links on macro re-exports
jyn514 Jun 12, 2020
82b3b07
Support intra-doc links on trait and module re-exports
jyn514 Jul 11, 2020
0ad1dcd
Add more debugging
jyn514 Jul 12, 2020
8387e38
Add (broken and ignored) test for #73829
jyn514 Jul 15, 2020
c46e038
Fix invalid lint
jyn514 Jul 16, 2020
9f00808
Remove `ExtCtxt::ident_of`.
nnethercote Jul 14, 2020
002af4d
Avoid storing `SymbolStr` in a struct.
nnethercote Jul 13, 2020
f03c7f8
Add `UnsafetyViolationDetails`.
nnethercote Jul 14, 2020
a4ba181
Remove some `Symbol:as_str()` calls.
nnethercote Jul 14, 2020
ec93d56
Rollup merge of #73101 - jyn514:rustdoc-absolute-module, r=Manishearth
Manishearth Jul 17, 2020
41d956b
Rollup merge of #73269 - mzohreva:mz/sgx-wait-timeout, r=jethrogb
Manishearth Jul 17, 2020
5751c7f
Rollup merge of #74033 - ehuss:std-compile-all-platforms, r=Mark-Simu…
Manishearth Jul 17, 2020
0e70884
Rollup merge of #74351 - lzutao:remove-rustc-internal-compiler-warns,…
Manishearth Jul 17, 2020
c60b051
Rollup merge of #74357 - nnethercote:symbol-related-improvements, r=o…
Manishearth Jul 17, 2020
874097c
Rollup merge of #74371 - Aloso:patch-1, r=GuilliameGomez
Manishearth Jul 17, 2020
b1ba961
Rollup merge of #74386 - msizanoen1:riscv-add-manifest-host, r=pietro…
Manishearth Jul 17, 2020
5bb9bef
Rollup merge of #74398 - GuillaumeGomez:cleanup-e0723, r=Dylan-DPC
Manishearth Jul 17, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use cfg_if in libtest.
Simplifies some of the expressions, and provides a default.
  • Loading branch information
ehuss committed Jul 15, 2020
commit 432b4c14aad49f27bad3c59bb3bc85595e21a71b
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4552,6 +4552,7 @@ dependencies = [
name = "test"
version = "0.0.0"
dependencies = [
"cfg-if",
"core",
"getopts",
"libc",
Expand Down
1 change: 1 addition & 0 deletions src/libtest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ path = "lib.rs"
crate-type = ["dylib", "rlib"]

[dependencies]
cfg-if = { version = "0.1.8", features = ['rustc-dep-of-std'] }
getopts = { version = "0.2.21", features = ['rustc-dep-of-std'] }
term = { path = "../libterm" }
std = { path = "../libstd" }
Expand Down
171 changes: 69 additions & 102 deletions src/libtest/helpers/concurrency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,61 +14,36 @@ pub fn get_concurrency() -> usize {
}
Err(..) => num_cpus(),
};
}

#[cfg(windows)]
#[allow(nonstandard_style)]
fn num_cpus() -> usize {
#[repr(C)]
struct SYSTEM_INFO {
wProcessorArchitecture: u16,
wReserved: u16,
dwPageSize: u32,
lpMinimumApplicationAddress: *mut u8,
lpMaximumApplicationAddress: *mut u8,
dwActiveProcessorMask: *mut u8,
dwNumberOfProcessors: u32,
dwProcessorType: u32,
dwAllocationGranularity: u32,
wProcessorLevel: u16,
wProcessorRevision: u16,
}
extern "system" {
fn GetSystemInfo(info: *mut SYSTEM_INFO) -> i32;
}
unsafe {
let mut sysinfo = std::mem::zeroed();
GetSystemInfo(&mut sysinfo);
sysinfo.dwNumberOfProcessors as usize
cfg_if::cfg_if! {
if #[cfg(windows)] {
#[allow(nonstandard_style)]
fn num_cpus() -> usize {
#[repr(C)]
struct SYSTEM_INFO {
wProcessorArchitecture: u16,
wReserved: u16,
dwPageSize: u32,
lpMinimumApplicationAddress: *mut u8,
lpMaximumApplicationAddress: *mut u8,
dwActiveProcessorMask: *mut u8,
dwNumberOfProcessors: u32,
dwProcessorType: u32,
dwAllocationGranularity: u32,
wProcessorLevel: u16,
wProcessorRevision: u16,
}
extern "system" {
fn GetSystemInfo(info: *mut SYSTEM_INFO) -> i32;
}
unsafe {
let mut sysinfo = std::mem::zeroed();
GetSystemInfo(&mut sysinfo);
sysinfo.dwNumberOfProcessors as usize
}
}
}

#[cfg(target_os = "vxworks")]
fn num_cpus() -> usize {
// FIXME: Implement num_cpus on vxWorks
1
}

#[cfg(target_os = "redox")]
fn num_cpus() -> usize {
// FIXME: Implement num_cpus on Redox
1
}

#[cfg(target_os = "hermit")]
fn num_cpus() -> usize {
// FIXME: Implement num_cpus on HermitCore
1
}

#[cfg(any(
all(target_arch = "wasm32", not(target_os = "emscripten")),
all(target_vendor = "fortanix", target_env = "sgx")
))]
fn num_cpus() -> usize {
1
}

#[cfg(any(
} else if #[cfg(any(
target_os = "android",
target_os = "cloudabi",
target_os = "emscripten",
Expand All @@ -78,23 +53,46 @@ pub fn get_concurrency() -> usize {
target_os = "macos",
target_os = "solaris",
target_os = "illumos",
))]
fn num_cpus() -> usize {
unsafe { libc::sysconf(libc::_SC_NPROCESSORS_ONLN) as usize }
}

#[cfg(any(target_os = "freebsd", target_os = "dragonfly", target_os = "netbsd"))]
fn num_cpus() -> usize {
use std::ptr;
))] {
fn num_cpus() -> usize {
unsafe { libc::sysconf(libc::_SC_NPROCESSORS_ONLN) as usize }
}
} else if #[cfg(any(target_os = "freebsd", target_os = "dragonfly", target_os = "netbsd"))] {
fn num_cpus() -> usize {
use std::ptr;

let mut cpus: libc::c_uint = 0;
let mut cpus_size = std::mem::size_of_val(&cpus);
let mut cpus: libc::c_uint = 0;
let mut cpus_size = std::mem::size_of_val(&cpus);

unsafe {
cpus = libc::sysconf(libc::_SC_NPROCESSORS_ONLN) as libc::c_uint;
unsafe {
cpus = libc::sysconf(libc::_SC_NPROCESSORS_ONLN) as libc::c_uint;
}
if cpus < 1 {
let mut mib = [libc::CTL_HW, libc::HW_NCPU, 0, 0];
unsafe {
libc::sysctl(
mib.as_mut_ptr(),
2,
&mut cpus as *mut _ as *mut _,
&mut cpus_size as *mut _ as *mut _,
ptr::null_mut(),
0,
);
}
if cpus < 1 {
cpus = 1;
}
}
cpus as usize
}
if cpus < 1 {
} else if #[cfg(target_os = "openbsd")] {
fn num_cpus() -> usize {
use std::ptr;

let mut cpus: libc::c_uint = 0;
let mut cpus_size = std::mem::size_of_val(&cpus);
let mut mib = [libc::CTL_HW, libc::HW_NCPU, 0, 0];

unsafe {
libc::sysctl(
mib.as_mut_ptr(),
Expand All @@ -108,43 +106,12 @@ pub fn get_concurrency() -> usize {
if cpus < 1 {
cpus = 1;
}
cpus as usize
}
cpus as usize
}

#[cfg(target_os = "openbsd")]
fn num_cpus() -> usize {
use std::ptr;

let mut cpus: libc::c_uint = 0;
let mut cpus_size = std::mem::size_of_val(&cpus);
let mut mib = [libc::CTL_HW, libc::HW_NCPU, 0, 0];

unsafe {
libc::sysctl(
mib.as_mut_ptr(),
2,
&mut cpus as *mut _ as *mut _,
&mut cpus_size as *mut _ as *mut _,
ptr::null_mut(),
0,
);
}
if cpus < 1 {
cpus = 1;
} else {
// FIXME: implement on vxWorks, Redox, HermitCore, Haiku, l4re
fn num_cpus() -> usize {
1
}
cpus as usize
}

#[cfg(target_os = "haiku")]
fn num_cpus() -> usize {
// FIXME: implement
1
}

#[cfg(target_os = "l4re")]
fn num_cpus() -> usize {
// FIXME: implement
1
}
}
56 changes: 27 additions & 29 deletions src/libtest/helpers/isatty.rs
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
//! Helper module which provides a function to test
//! if stdout is a tty.

#[cfg(any(
target_os = "cloudabi",
target_os = "hermit",
all(target_arch = "wasm32", not(target_os = "emscripten")),
all(target_vendor = "fortanix", target_env = "sgx")
))]
pub fn stdout_isatty() -> bool {
// FIXME: Implement isatty on SGX
false
}
#[cfg(unix)]
pub fn stdout_isatty() -> bool {
unsafe { libc::isatty(libc::STDOUT_FILENO) != 0 }
}
#[cfg(windows)]
pub fn stdout_isatty() -> bool {
type DWORD = u32;
type BOOL = i32;
type HANDLE = *mut u8;
type LPDWORD = *mut u32;
const STD_OUTPUT_HANDLE: DWORD = -11i32 as DWORD;
extern "system" {
fn GetStdHandle(which: DWORD) -> HANDLE;
fn GetConsoleMode(hConsoleHandle: HANDLE, lpMode: LPDWORD) -> BOOL;
}
unsafe {
let handle = GetStdHandle(STD_OUTPUT_HANDLE);
let mut out = 0;
GetConsoleMode(handle, &mut out) != 0
cfg_if::cfg_if! {
if #[cfg(unix)] {
pub fn stdout_isatty() -> bool {
unsafe { libc::isatty(libc::STDOUT_FILENO) != 0 }
}
} else if #[cfg(windows)] {
pub fn stdout_isatty() -> bool {
type DWORD = u32;
type BOOL = i32;
type HANDLE = *mut u8;
type LPDWORD = *mut u32;
const STD_OUTPUT_HANDLE: DWORD = -11i32 as DWORD;
extern "system" {
fn GetStdHandle(which: DWORD) -> HANDLE;
fn GetConsoleMode(hConsoleHandle: HANDLE, lpMode: LPDWORD) -> BOOL;
}
unsafe {
let handle = GetStdHandle(STD_OUTPUT_HANDLE);
let mut out = 0;
GetConsoleMode(handle, &mut out) != 0
}
}
} else {
// FIXME: Implement isatty on SGX
pub fn stdout_isatty() -> bool {
false
}
}
}