summaryrefslogtreecommitdiff
path: root/src/libpanic_unwind/lib.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-07-27 17:39:01 +0000
committerbors <bors@rust-lang.org>2020-07-27 17:39:01 +0000
commit54e000891ffccd4cbfb92146b92736c83085df63 (patch)
tree1200bb13eb9ae22def4c43bc657bc56da8faedc6 /src/libpanic_unwind/lib.rs
parent4a90e36c85336d1d4b209556c1a9733210bbff19 (diff)
parent6d9705220fec4553d693a7c19d99496e14c89edf (diff)
downloadrust-tmp-nightly.tar.gz
Auto merge of #73265 - mark-i-m:mv-std, r=<try>tmp-nightly
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/libpanic_unwind/lib.rs')
-rw-r--r--src/libpanic_unwind/lib.rs110
1 files changed, 0 insertions, 110 deletions
diff --git a/src/libpanic_unwind/lib.rs b/src/libpanic_unwind/lib.rs
deleted file mode 100644
index 72eab0763d8..00000000000
--- a/src/libpanic_unwind/lib.rs
+++ /dev/null
@@ -1,110 +0,0 @@
-//! Implementation of panics via stack unwinding
-//!
-//! This crate is an implementation of panics in Rust using "most native" stack
-//! unwinding mechanism of the platform this is being compiled for. This
-//! essentially gets categorized into three buckets currently:
-//!
-//! 1. MSVC targets use SEH in the `seh.rs` file.
-//! 2. Emscripten uses C++ exceptions in the `emcc.rs` file.
-//! 3. All other targets use libunwind/libgcc in the `gcc.rs` file.
-//!
-//! More documentation about each implementation can be found in the respective
-//! module.
-
-#![no_std]
-#![unstable(feature = "panic_unwind", issue = "32837")]
-#![doc(
- html_root_url = "https://doc.rust-lang.org/nightly/",
- issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/"
-)]
-#![feature(core_intrinsics)]
-#![feature(lang_items)]
-#![feature(libc)]
-#![feature(nll)]
-#![feature(panic_unwind)]
-#![feature(staged_api)]
-#![feature(std_internals)]
-#![feature(unwind_attributes)]
-#![feature(abi_thiscall)]
-#![feature(rustc_attrs)]
-#![feature(raw)]
-#![panic_runtime]
-#![feature(panic_runtime)]
-// `real_imp` is unused with Miri, so silence warnings.
-#![cfg_attr(miri, allow(dead_code))]
-
-use alloc::boxed::Box;
-use core::any::Any;
-use core::panic::BoxMeUp;
-
-cfg_if::cfg_if! {
- if #[cfg(target_os = "emscripten")] {
- #[path = "emcc.rs"]
- mod real_imp;
- } else if #[cfg(target_os = "hermit")] {
- #[path = "hermit.rs"]
- mod real_imp;
- } else if #[cfg(target_env = "msvc")] {
- #[path = "seh.rs"]
- mod real_imp;
- } else if #[cfg(any(
- all(target_family = "windows", target_env = "gnu"),
- target_os = "cloudabi",
- target_family = "unix",
- all(target_vendor = "fortanix", target_env = "sgx"),
- ))] {
- // Rust runtime's startup objects depend on these symbols, so make them public.
- #[cfg(all(target_os="windows", target_arch = "x86", target_env="gnu"))]
- pub use real_imp::eh_frame_registry::*;
- #[path = "gcc.rs"]
- mod real_imp;
- } else {
- // Targets that don't support unwinding.
- // - arch=wasm32
- // - os=none ("bare metal" targets)
- // - os=uefi
- // - nvptx64-nvidia-cuda
- // - avr-unknown-unknown
- // - mipsel-sony-psp
- #[path = "dummy.rs"]
- mod real_imp;
- }
-}
-
-cfg_if::cfg_if! {
- if #[cfg(miri)] {
- // Use the Miri runtime.
- // We still need to also load the normal runtime above, as rustc expects certain lang
- // items from there to be defined.
- #[path = "miri.rs"]
- mod imp;
- } else {
- // Use the real runtime.
- use real_imp as imp;
- }
-}
-
-extern "C" {
- /// Handler in libstd called when a panic object is dropped outside of
- /// `catch_unwind`.
- fn __rust_drop_panic() -> !;
-}
-
-mod dwarf;
-
-#[rustc_std_internal_symbol]
-#[allow(improper_ctypes_definitions)]
-pub unsafe extern "C" fn __rust_panic_cleanup(payload: *mut u8) -> *mut (dyn Any + Send + 'static) {
- Box::into_raw(imp::cleanup(payload))
-}
-
-// Entry point for raising an exception, just delegates to the platform-specific
-// implementation.
-#[rustc_std_internal_symbol]
-#[unwind(allowed)]
-pub unsafe extern "C" fn __rust_start_panic(payload: usize) -> u32 {
- let payload = payload as *mut &mut dyn BoxMeUp;
- let payload = (*payload).take_box();
-
- imp::panic(Box::from_raw(payload))
-}