From aad1c998c7a08dd06719845dd5b3b962dfcb0be7 Mon Sep 17 00:00:00 2001 From: est31 Date: Thu, 5 Oct 2017 05:01:41 +0200 Subject: [PATCH] Remove nacl from libstd --- src/libstd/os/mod.rs | 1 - src/libstd/os/nacl/fs.rs | 128 ------------------ src/libstd/os/nacl/mod.rs | 16 --- src/libstd/os/nacl/raw.rs | 56 -------- src/libstd/sys/unix/env.rs | 21 --- src/libstd/sys/unix/mod.rs | 5 +- src/libstd/sys/unix/os.rs | 2 - src/libstd/sys/unix/process/process_common.rs | 1 - src/libstd/sys/unix/process/process_unix.rs | 4 +- src/libstd/sys_common/backtrace.rs | 2 - 10 files changed, 4 insertions(+), 232 deletions(-) delete mode 100644 src/libstd/os/nacl/fs.rs delete mode 100644 src/libstd/os/nacl/mod.rs delete mode 100644 src/libstd/os/nacl/raw.rs diff --git a/src/libstd/os/mod.rs b/src/libstd/os/mod.rs index b460bd90f17..122f15d1d4c 100644 --- a/src/libstd/os/mod.rs +++ b/src/libstd/os/mod.rs @@ -38,7 +38,6 @@ pub mod linux; #[cfg(all(not(dox), target_os = "haiku"))] pub mod haiku; #[cfg(all(not(dox), target_os = "ios"))] pub mod ios; #[cfg(all(not(dox), target_os = "macos"))] pub mod macos; -#[cfg(all(not(dox), target_os = "nacl"))] pub mod nacl; #[cfg(all(not(dox), target_os = "netbsd"))] pub mod netbsd; #[cfg(all(not(dox), target_os = "openbsd"))] pub mod openbsd; #[cfg(all(not(dox), target_os = "solaris"))] pub mod solaris; diff --git a/src/libstd/os/nacl/fs.rs b/src/libstd/os/nacl/fs.rs deleted file mode 100644 index 3e0fb44b01e..00000000000 --- a/src/libstd/os/nacl/fs.rs +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![stable(feature = "metadata_ext", since = "1.1.0")] - -use libc; - -use fs::Metadata; -use sys_common::AsInner; - -#[allow(deprecated)] -use os::nacl::raw; - -/// OS-specific extension methods for `fs::Metadata` -#[stable(feature = "metadata_ext", since = "1.1.0")] -pub trait MetadataExt { - /// Gain a reference to the underlying `stat` structure which contains - /// the raw information returned by the OS. - /// - /// The contents of the returned `stat` are **not** consistent across - /// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the - /// cross-Unix abstractions contained within the raw stat. - #[stable(feature = "metadata_ext", since = "1.1.0")] - #[rustc_deprecated(since = "1.8.0", - reason = "deprecated in favor of the accessor \ - methods of this trait")] - #[allow(deprecated)] - fn as_raw_stat(&self) -> &raw::stat; - - #[stable(feature = "metadata_ext2", since = "1.8.0")] - fn st_dev(&self) -> u64; - #[stable(feature = "metadata_ext2", since = "1.8.0")] - fn st_ino(&self) -> u64; - #[stable(feature = "metadata_ext2", since = "1.8.0")] - fn st_mode(&self) -> u32; - #[stable(feature = "metadata_ext2", since = "1.8.0")] - fn st_nlink(&self) -> u64; - #[stable(feature = "metadata_ext2", since = "1.8.0")] - fn st_uid(&self) -> u32; - #[stable(feature = "metadata_ext2", since = "1.8.0")] - fn st_gid(&self) -> u32; - #[stable(feature = "metadata_ext2", since = "1.8.0")] - fn st_rdev(&self) -> u64; - #[stable(feature = "metadata_ext2", since = "1.8.0")] - fn st_size(&self) -> u64; - #[stable(feature = "metadata_ext2", since = "1.8.0")] - fn st_atime(&self) -> i64; - #[stable(feature = "metadata_ext2", since = "1.8.0")] - fn st_atime_nsec(&self) -> i64; - #[stable(feature = "metadata_ext2", since = "1.8.0")] - fn st_mtime(&self) -> i64; - #[stable(feature = "metadata_ext2", since = "1.8.0")] - fn st_mtime_nsec(&self) -> i64; - #[stable(feature = "metadata_ext2", since = "1.8.0")] - fn st_ctime(&self) -> i64; - #[stable(feature = "metadata_ext2", since = "1.8.0")] - fn st_ctime_nsec(&self) -> i64; - #[stable(feature = "metadata_ext2", since = "1.8.0")] - fn st_blksize(&self) -> u64; - #[stable(feature = "metadata_ext2", since = "1.8.0")] - fn st_blocks(&self) -> u64; -} - -#[stable(feature = "metadata_ext", since = "1.1.0")] -impl MetadataExt for Metadata { - #[allow(deprecated)] - fn as_raw_stat(&self) -> &raw::stat { - unsafe { - &*(self.as_inner().as_inner() as *const libc::stat64 - as *const raw::stat) - } - } - fn st_dev(&self) -> u64 { - self.as_inner().as_inner().st_dev as u64 - } - fn st_ino(&self) -> u64 { - self.as_inner().as_inner().st_ino as u64 - } - fn st_mode(&self) -> u32 { - self.as_inner().as_inner().st_mode as u32 - } - fn st_nlink(&self) -> u64 { - self.as_inner().as_inner().st_nlink as u64 - } - fn st_uid(&self) -> u32 { - self.as_inner().as_inner().st_uid as u32 - } - fn st_gid(&self) -> u32 { - self.as_inner().as_inner().st_gid as u32 - } - fn st_rdev(&self) -> u64 { - self.as_inner().as_inner().st_rdev as u64 - } - fn st_size(&self) -> u64 { - self.as_inner().as_inner().st_size as u64 - } - fn st_atime(&self) -> i64 { - self.as_inner().as_inner().st_atime as i64 - } - fn st_atime_nsec(&self) -> i64 { - self.as_inner().as_inner().st_atime_nsec as i64 - } - fn st_mtime(&self) -> i64 { - self.as_inner().as_inner().st_mtime as i64 - } - fn st_mtime_nsec(&self) -> i64 { - self.as_inner().as_inner().st_mtime_nsec as i64 - } - fn st_ctime(&self) -> i64 { - self.as_inner().as_inner().st_ctime as i64 - } - fn st_ctime_nsec(&self) -> i64 { - self.as_inner().as_inner().st_ctime_nsec as i64 - } - fn st_blksize(&self) -> u64 { - self.as_inner().as_inner().st_blksize as u64 - } - fn st_blocks(&self) -> u64 { - self.as_inner().as_inner().st_blocks as u64 - } -} diff --git a/src/libstd/os/nacl/mod.rs b/src/libstd/os/nacl/mod.rs deleted file mode 100644 index 7dfa2eabe3e..00000000000 --- a/src/libstd/os/nacl/mod.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Nacl-specific definitions - -#![stable(feature = "raw_ext", since = "1.1.0")] - -pub mod raw; -pub mod fs; diff --git a/src/libstd/os/nacl/raw.rs b/src/libstd/os/nacl/raw.rs deleted file mode 100644 index 3c3d4410a2a..00000000000 --- a/src/libstd/os/nacl/raw.rs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Nacl-specific raw type definitions - -#![stable(feature = "raw_ext", since = "1.1.0")] -#![rustc_deprecated(since = "1.8.0", - reason = "these type aliases are no longer supported by \ - the standard library, the `libc` crate on \ - crates.io should be used instead for the correct \ - definitions")] -#![allow(deprecated)] - -#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64; -#[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = u64; -#[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64; -#[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u64; -#[stable(feature = "raw_ext", since = "1.1.0")] pub type pid_t = i32; -#[stable(feature = "raw_ext", since = "1.1.0")] pub type uid_t = u32; -#[stable(feature = "raw_ext", since = "1.1.0")] pub type gid_t = u32; -#[stable(feature = "raw_ext", since = "1.1.0")] pub type mode_t = u32; -#[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = u64; -#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; -#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; - -#[stable(feature = "pthread_t", since = "1.8.0")] -pub type pthread_t = usize; - -#[repr(C)] -#[derive(Copy, Clone)] -#[stable(feature = "raw_ext", since = "1.1.0")] -pub struct stat { - #[stable(feature = "raw_ext", since = "1.1.0")] pub st_dev: dev_t, - #[stable(feature = "raw_ext", since = "1.1.0")] pub st_ino: ino_t, - #[stable(feature = "raw_ext", since = "1.1.0")] pub st_mode: mode_t, - #[stable(feature = "raw_ext", since = "1.1.0")] pub st_nlink: nlink_t, - #[stable(feature = "raw_ext", since = "1.1.0")] pub st_uid: uid_t, - #[stable(feature = "raw_ext", since = "1.1.0")] pub st_gid: gid_t, - #[stable(feature = "raw_ext", since = "1.1.0")] pub st_rdev: dev_t, - #[stable(feature = "raw_ext", since = "1.1.0")] pub st_size: off_t, - #[stable(feature = "raw_ext", since = "1.1.0")] pub st_blksize: blksize_t, - #[stable(feature = "raw_ext", since = "1.1.0")] pub st_blocks: blkcnt_t, - #[stable(feature = "raw_ext", since = "1.1.0")] pub st_atime: time_t, - #[stable(feature = "raw_ext", since = "1.1.0")] pub st_atime_nsec: i64, - #[stable(feature = "raw_ext", since = "1.1.0")] pub st_mtime: time_t, - #[stable(feature = "raw_ext", since = "1.1.0")] pub st_mtime_nsec: i64, - #[stable(feature = "raw_ext", since = "1.1.0")] pub st_ctime: time_t, - #[stable(feature = "raw_ext", since = "1.1.0")] pub st_ctime_nsec: i64, -} diff --git a/src/libstd/sys/unix/env.rs b/src/libstd/sys/unix/env.rs index 3d9a06bedd5..00cf7eca75d 100644 --- a/src/libstd/sys/unix/env.rs +++ b/src/libstd/sys/unix/env.rs @@ -118,27 +118,6 @@ pub mod os { pub const EXE_EXTENSION: &'static str = ""; } -#[cfg(all(target_os = "nacl", not(target_arch = "le32")))] -pub mod os { - pub const FAMILY: &'static str = "unix"; - pub const OS: &'static str = "nacl"; - pub const DLL_PREFIX: &'static str = "lib"; - pub const DLL_SUFFIX: &'static str = ".so"; - pub const DLL_EXTENSION: &'static str = "so"; - pub const EXE_SUFFIX: &'static str = ".nexe"; - pub const EXE_EXTENSION: &'static str = "nexe"; -} -#[cfg(all(target_os = "nacl", target_arch = "le32"))] -pub mod os { - pub const FAMILY: &'static str = "unix"; - pub const OS: &'static str = "pnacl"; - pub const DLL_PREFIX: &'static str = "lib"; - pub const DLL_SUFFIX: &'static str = ".pso"; - pub const DLL_EXTENSION: &'static str = "pso"; - pub const EXE_SUFFIX: &'static str = ".pexe"; - pub const EXE_EXTENSION: &'static str = "pexe"; -} - #[cfg(target_os = "haiku")] pub mod os { pub const FAMILY: &'static str = "unix"; diff --git a/src/libstd/sys/unix/mod.rs b/src/libstd/sys/unix/mod.rs index 1b3f1000b77..c2772e2e2cc 100644 --- a/src/libstd/sys/unix/mod.rs +++ b/src/libstd/sys/unix/mod.rs @@ -22,7 +22,6 @@ use libc; #[cfg(all(not(dox), target_os = "haiku"))] pub use os::haiku as platform; #[cfg(all(not(dox), target_os = "ios"))] pub use os::ios as platform; #[cfg(all(not(dox), target_os = "macos"))] pub use os::macos as platform; -#[cfg(all(not(dox), target_os = "nacl"))] pub use os::nacl as platform; #[cfg(all(not(dox), target_os = "netbsd"))] pub use os::netbsd as platform; #[cfg(all(not(dox), target_os = "openbsd"))] pub use os::openbsd as platform; #[cfg(all(not(dox), target_os = "solaris"))] pub use os::solaris as platform; @@ -77,11 +76,11 @@ pub fn init() { reset_sigpipe(); } - #[cfg(not(any(target_os = "nacl", target_os = "emscripten", target_os="fuchsia")))] + #[cfg(not(any(target_os = "emscripten", target_os="fuchsia")))] unsafe fn reset_sigpipe() { assert!(signal(libc::SIGPIPE, libc::SIG_IGN) != libc::SIG_ERR); } - #[cfg(any(target_os = "nacl", target_os = "emscripten", target_os="fuchsia"))] + #[cfg(any(target_os = "emscripten", target_os="fuchsia"))] unsafe fn reset_sigpipe() {} } diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs index 5ef98d24710..d8c30534eed 100644 --- a/src/libstd/sys/unix/os.rs +++ b/src/libstd/sys/unix/os.rs @@ -483,12 +483,10 @@ pub fn home_dir() -> Option { #[cfg(any(target_os = "android", target_os = "ios", - target_os = "nacl", target_os = "emscripten"))] unsafe fn fallback() -> Option { None } #[cfg(not(any(target_os = "android", target_os = "ios", - target_os = "nacl", target_os = "emscripten")))] unsafe fn fallback() -> Option { let amt = match libc::sysconf(libc::_SC_GETPW_R_SIZE_MAX) { diff --git a/src/libstd/sys/unix/process/process_common.rs b/src/libstd/sys/unix/process/process_common.rs index 689ccd78524..383434b1cd8 100644 --- a/src/libstd/sys/unix/process/process_common.rs +++ b/src/libstd/sys/unix/process/process_common.rs @@ -464,7 +464,6 @@ mod tests { // test from being flaky we ignore it on macOS. #[test] #[cfg_attr(target_os = "macos", ignore)] - #[cfg_attr(target_os = "nacl", ignore)] // no signals on NaCl. // When run under our current QEMU emulation test suite this test fails, // although the reason isn't very clear as to why. For now this test is // ignored there. diff --git a/src/libstd/sys/unix/process/process_unix.rs b/src/libstd/sys/unix/process/process_unix.rs index 870db820027..743c458d580 100644 --- a/src/libstd/sys/unix/process/process_unix.rs +++ b/src/libstd/sys/unix/process/process_unix.rs @@ -184,8 +184,8 @@ impl Command { *sys::os::environ() = envp.as_ptr(); } - // NaCl has no signal support. - #[cfg(not(any(target_os = "nacl", target_os = "emscripten")))] + // emscripten has no signal support. + #[cfg(not(any(target_os = "emscripten")))] { use mem; // Reset signal handling so the child process starts in a diff --git a/src/libstd/sys_common/backtrace.rs b/src/libstd/sys_common/backtrace.rs index 617218fe7a5..8f78c2e6f59 100644 --- a/src/libstd/sys_common/backtrace.rs +++ b/src/libstd/sys_common/backtrace.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![cfg_attr(target_os = "nacl", allow(dead_code))] - /// Common code for printing the backtrace in the same way across the different /// supported platforms.