mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 14:01:51 +00:00
libpanic_unwind => 2018
This commit is contained in:
parent
e544947278
commit
f2fe12a8ab
@ -2,6 +2,7 @@
|
||||
authors = ["The Rust Project Developers"]
|
||||
name = "panic_unwind"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
path = "lib.rs"
|
||||
|
@ -11,7 +11,7 @@
|
||||
#![allow(non_upper_case_globals)]
|
||||
#![allow(unused)]
|
||||
|
||||
use dwarf::DwarfReader;
|
||||
use crate::dwarf::DwarfReader;
|
||||
use core::mem;
|
||||
|
||||
pub const DW_EH_PE_omit: u8 = 0xFF;
|
||||
@ -51,7 +51,7 @@ pub enum EHAction {
|
||||
|
||||
pub const USING_SJLJ_EXCEPTIONS: bool = cfg!(all(target_os = "ios", target_arch = "arm"));
|
||||
|
||||
pub unsafe fn find_eh_action(lsda: *const u8, context: &EHContext)
|
||||
pub unsafe fn find_eh_action(lsda: *const u8, context: &EHContext<'_>)
|
||||
-> Result<EHAction, ()>
|
||||
{
|
||||
if lsda.is_null() {
|
||||
@ -145,7 +145,7 @@ fn round_up(unrounded: usize, align: usize) -> Result<usize, ()> {
|
||||
}
|
||||
|
||||
unsafe fn read_encoded_pointer(reader: &mut DwarfReader,
|
||||
context: &EHContext,
|
||||
context: &EHContext<'_>,
|
||||
encoding: u8)
|
||||
-> Result<usize, ()> {
|
||||
if encoding == DW_EH_PE_omit {
|
||||
|
@ -10,10 +10,10 @@
|
||||
|
||||
use core::any::Any;
|
||||
use core::ptr;
|
||||
use core::mem;
|
||||
use alloc::boxed::Box;
|
||||
use libc::{self, c_int};
|
||||
use unwind as uw;
|
||||
use core::mem;
|
||||
|
||||
pub fn payload() -> *mut u8 {
|
||||
ptr::null_mut()
|
||||
|
@ -52,7 +52,7 @@ use alloc::boxed::Box;
|
||||
|
||||
use unwind as uw;
|
||||
use libc::{c_int, uintptr_t};
|
||||
use dwarf::eh::{self, EHContext, EHAction};
|
||||
use crate::dwarf::eh::{self, EHContext, EHAction};
|
||||
|
||||
#[repr(C)]
|
||||
struct Exception {
|
||||
|
@ -17,6 +17,8 @@
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/",
|
||||
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/")]
|
||||
|
||||
#![deny(rust_2018_idioms)]
|
||||
|
||||
#![feature(allocator_api)]
|
||||
#![feature(alloc)]
|
||||
#![feature(core_intrinsics)]
|
||||
@ -32,8 +34,6 @@
|
||||
#![panic_runtime]
|
||||
#![feature(panic_runtime)]
|
||||
|
||||
extern crate alloc;
|
||||
extern crate libc;
|
||||
#[cfg(not(any(target_env = "msvc", all(windows, target_arch = "x86_64", target_env = "gnu"))))]
|
||||
extern crate unwind;
|
||||
|
||||
@ -87,7 +87,7 @@ pub unsafe extern "C" fn __rust_maybe_catch_panic(f: fn(*mut u8),
|
||||
vtable_ptr: *mut usize)
|
||||
-> u32 {
|
||||
let mut payload = imp::payload();
|
||||
if intrinsics::try(f, data, &mut payload as *mut _ as *mut _) == 0 {
|
||||
if intrinsics::r#try(f, data, &mut payload as *mut _ as *mut _) == 0 {
|
||||
0
|
||||
} else {
|
||||
let obj = mem::transmute::<_, raw::TraitObject>(imp::cleanup(payload));
|
||||
|
@ -52,7 +52,7 @@ use core::any::Any;
|
||||
use core::mem;
|
||||
use core::raw;
|
||||
|
||||
use windows as c;
|
||||
use crate::windows as c;
|
||||
use libc::{c_int, c_uint};
|
||||
|
||||
// First up, a whole bunch of type definitions. There's a few platform-specific
|
||||
@ -301,5 +301,5 @@ pub unsafe fn cleanup(payload: [u64; 2]) -> Box<dyn Any + Send> {
|
||||
#[lang = "eh_personality"]
|
||||
#[cfg(not(test))]
|
||||
fn rust_eh_personality() {
|
||||
unsafe { ::core::intrinsics::abort() }
|
||||
unsafe { core::intrinsics::abort() }
|
||||
}
|
||||
|
@ -9,8 +9,8 @@ use alloc::boxed::Box;
|
||||
use core::any::Any;
|
||||
use core::intrinsics;
|
||||
use core::ptr;
|
||||
use dwarf::eh::{EHContext, EHAction, find_eh_action};
|
||||
use windows as c;
|
||||
use crate::dwarf::eh::{EHContext, EHAction, find_eh_action};
|
||||
use crate::windows as c;
|
||||
|
||||
// Define our exception codes:
|
||||
// according to http://msdn.microsoft.com/en-us/library/het71c37(v=VS.80).aspx,
|
||||
|
Loading…
Reference in New Issue
Block a user