From f4be2026dfb507e5db919cc5df8fd934e05fa0b8 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 8 Sep 2015 15:53:46 -0700 Subject: std: Internalize almost all of `std::rt` This commit does some refactoring to make almost all of the `std::rt` private. Specifically, the following items are no longer part of its API: * DEFAULT_ERROR_CODE * backtrace * unwind * args * at_exit * cleanup * heap (this is just alloc::heap) * min_stack * util The module is now tagged as `#[doc(hidden)]` as the only purpose it's serve is an entry point for the `panic!` macro via the `begin_unwind` and `begin_unwind_fmt` reexports. --- src/libstd/sys/windows/mod.rs | 2 ++ src/libstd/sys/windows/net.rs | 5 ++--- src/libstd/sys/windows/stack_overflow.rs | 2 +- src/libstd/sys/windows/thread_local.rs | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src/libstd/sys/windows') diff --git a/src/libstd/sys/windows/mod.rs b/src/libstd/sys/windows/mod.rs index 732e2e65864..04bb5e5ea38 100644 --- a/src/libstd/sys/windows/mod.rs +++ b/src/libstd/sys/windows/mod.rs @@ -43,6 +43,8 @@ pub mod thread_local; pub mod time; pub mod stdio; +pub fn init() {} + pub fn decode_error_kind(errno: i32) -> ErrorKind { match errno as libc::c_int { libc::ERROR_ACCESS_DENIED => ErrorKind::PermissionDenied, diff --git a/src/libstd/sys/windows/net.rs b/src/libstd/sys/windows/net.rs index e62b2d8cb18..998b4fcb1a1 100644 --- a/src/libstd/sys/windows/net.rs +++ b/src/libstd/sys/windows/net.rs @@ -16,11 +16,10 @@ use net::SocketAddr; use num::One; use ops::Neg; use ptr; -use rt; use sync::Once; use sys; use sys::c; -use sys_common::{AsInner, FromInner, IntoInner}; +use sys_common::{self, AsInner, FromInner, IntoInner}; use sys_common::net::{setsockopt, getsockopt}; use time::Duration; @@ -39,7 +38,7 @@ pub fn init() { &mut data); assert_eq!(ret, 0); - let _ = rt::at_exit(|| { c::WSACleanup(); }); + let _ = sys_common::at_exit(|| { c::WSACleanup(); }); }); } diff --git a/src/libstd/sys/windows/stack_overflow.rs b/src/libstd/sys/windows/stack_overflow.rs index f93f7c756de..d1c2144ef0d 100644 --- a/src/libstd/sys/windows/stack_overflow.rs +++ b/src/libstd/sys/windows/stack_overflow.rs @@ -9,7 +9,7 @@ // except according to those terms. use libc::{self, LONG}; -use rt::util::report_overflow; +use sys_common::util::report_overflow; use sys::c; pub struct Handler; diff --git a/src/libstd/sys/windows/thread_local.rs b/src/libstd/sys/windows/thread_local.rs index 17bc7ee8876..c544eec7fce 100644 --- a/src/libstd/sys/windows/thread_local.rs +++ b/src/libstd/sys/windows/thread_local.rs @@ -13,7 +13,7 @@ use prelude::v1::*; use libc::types::os::arch::extra::{DWORD, LPVOID, BOOL}; use ptr; -use rt; +use sys_common; use sys_common::mutex::Mutex; pub type Key = DWORD; @@ -133,7 +133,7 @@ unsafe fn init_dtors() { let dtors = box Vec::<(Key, Dtor)>::new(); - let res = rt::at_exit(move|| { + let res = sys_common::at_exit(move|| { DTOR_LOCK.lock(); let dtors = DTORS; DTORS = 1 as *mut _; -- cgit 1.4.1-3-g733a5