diff options
| author | bors <bors@rust-lang.org> | 2020-07-28 00:51:53 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-07-28 00:51:53 +0000 |
| commit | ac48e62db85e6db4bbe026490381ab205f4a614d (patch) | |
| tree | 14f64e683e3f64dcbcfb8c2c7cb45ac7592e6e09 /src/libstd/sys/windows/stack_overflow.rs | |
| parent | 9be8ffcb0206fc1558069a7b4766090df7877659 (diff) | |
| parent | 2c31b45ae878b821975c4ebd94cc1e49f6073fd0 (diff) | |
| download | rust-ac48e62db85e6db4bbe026490381ab205f4a614d.tar.gz rust-ac48e62db85e6db4bbe026490381ab205f4a614d.zip | |
Auto merge of #73265 - mark-i-m:mv-std, r=Mark-Simulacrum,mark-i-m
mv std libs to library/ This is the first step in refactoring the directory layout of this repository, with further followup steps planned (but not done yet). Background: currently, all crates are under src/, without nested src directories and with the unconventional `lib*` prefixes (e.g., `src/libcore/lib.rs`). This directory structures is not idiomatic and makes the `src/` directory rather overwhelming. To improve contributor experience and make things a bit more approachable, we are reorganizing the repo a bit. In this PR, we move the standard libs (basically anything that is "runtime", as opposed to part of the compiler, build system, or one of the tools, etc). The new layout moves these libraries to a new `library/` directory in the root of the repo. Additionally, we remove the `lib*` prefixes and add nested `src/` directories. The other crates/tools in this repo are not touched. So in summary: ``` library/<crate>/src/*.rs src/<all the rest> // unchanged ``` where `<crate>` is: - core - alloc - std - test - proc_macro - panic_abort - panic_unwind - profiler_builtins - term - unwind - rtstartup - backtrace - rustc-std-workspace-* There was a lot of discussion about this and a few rounds of compiler team approvals, FCPs, MCPs, and nominations. The original MCP is https://github.com/rust-lang/compiler-team/issues/298. The final approval of the compiler team was given here: https://github.com/rust-lang/rust/pull/73265#issuecomment-659498446. The name `library` was chosen to complement a later move of the compiler crates to a `compiler/` directory. There was a lot of discussion around adding the nested `src/` directories. Note that this does increase the nesting depth (plausibly important for manual traversal of the tree, e.g., through GitHub's UI or `cd`), but this is deemed to be better as it fits the standard layout of Rust crates throughout most of the ecosystem, though there is some debate about how much this should apply to multi-crate projects. Overall, there seem to be more people in favor of nested `src/` than against. After this PR, there are no dependencies out of the `library/` directory except on the `build_helper` (or crates.io crates).
Diffstat (limited to 'src/libstd/sys/windows/stack_overflow.rs')
| -rw-r--r-- | src/libstd/sys/windows/stack_overflow.rs | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/src/libstd/sys/windows/stack_overflow.rs b/src/libstd/sys/windows/stack_overflow.rs deleted file mode 100644 index 187ad4e66c3..00000000000 --- a/src/libstd/sys/windows/stack_overflow.rs +++ /dev/null @@ -1,41 +0,0 @@ -#![cfg_attr(test, allow(dead_code))] - -use crate::sys::c; -use crate::sys_common::util::report_overflow; - -pub struct Handler; - -impl Handler { - pub unsafe fn new() -> Handler { - // This API isn't available on XP, so don't panic in that case and just - // pray it works out ok. - if c::SetThreadStackGuarantee(&mut 0x5000) == 0 { - if c::GetLastError() as u32 != c::ERROR_CALL_NOT_IMPLEMENTED as u32 { - panic!("failed to reserve stack space for exception handling"); - } - } - Handler - } -} - -extern "system" fn vectored_handler(ExceptionInfo: *mut c::EXCEPTION_POINTERS) -> c::LONG { - unsafe { - let rec = &(*(*ExceptionInfo).ExceptionRecord); - let code = rec.ExceptionCode; - - if code == c::EXCEPTION_STACK_OVERFLOW { - report_overflow(); - } - c::EXCEPTION_CONTINUE_SEARCH - } -} - -pub unsafe fn init() { - if c::AddVectoredExceptionHandler(0, vectored_handler).is_null() { - panic!("failed to install exception handler"); - } - // Set the thread stack guarantee for the main thread. - let _h = Handler::new(); -} - -pub unsafe fn cleanup() {} |
