Skip to content

Commit 78c60bb

Browse files
authored
Rollup merge of rust-lang#58110 - Centril:libpanic_unwind-2018, r=oli-obk
libpanic_unwind => 2018 Transitions `libpanic_unwind` to Rust 2018; cc rust-lang#58099 r? @oli-obk
2 parents e544947 + bb08499 commit 78c60bb

File tree

9 files changed

+20
-21
lines changed

9 files changed

+20
-21
lines changed

src/libpanic_unwind/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
authors = ["The Rust Project Developers"]
33
name = "panic_unwind"
44
version = "0.0.0"
5+
edition = "2018"
56

67
[lib]
78
path = "lib.rs"

src/libpanic_unwind/dwarf/eh.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#![allow(non_upper_case_globals)]
1212
#![allow(unused)]
1313

14-
use dwarf::DwarfReader;
14+
use crate::dwarf::DwarfReader;
1515
use core::mem;
1616

1717
pub const DW_EH_PE_omit: u8 = 0xFF;
@@ -51,7 +51,7 @@ pub enum EHAction {
5151

5252
pub const USING_SJLJ_EXCEPTIONS: bool = cfg!(all(target_os = "ios", target_arch = "arm"));
5353

54-
pub unsafe fn find_eh_action(lsda: *const u8, context: &EHContext)
54+
pub unsafe fn find_eh_action(lsda: *const u8, context: &EHContext<'_>)
5555
-> Result<EHAction, ()>
5656
{
5757
if lsda.is_null() {
@@ -145,7 +145,7 @@ fn round_up(unrounded: usize, align: usize) -> Result<usize, ()> {
145145
}
146146

147147
unsafe fn read_encoded_pointer(reader: &mut DwarfReader,
148-
context: &EHContext,
148+
context: &EHContext<'_>,
149149
encoding: u8)
150150
-> Result<usize, ()> {
151151
if encoding == DW_EH_PE_omit {

src/libpanic_unwind/emcc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
use core::any::Any;
1212
use core::ptr;
13+
use core::mem;
1314
use alloc::boxed::Box;
1415
use libc::{self, c_int};
1516
use unwind as uw;
16-
use core::mem;
1717

1818
pub fn payload() -> *mut u8 {
1919
ptr::null_mut()

src/libpanic_unwind/gcc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ use alloc::boxed::Box;
5252

5353
use unwind as uw;
5454
use libc::{c_int, uintptr_t};
55-
use dwarf::eh::{self, EHContext, EHAction};
55+
use crate::dwarf::eh::{self, EHContext, EHAction};
5656

5757
#[repr(C)]
5858
struct Exception {

src/libpanic_unwind/lib.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/",
1818
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/")]
1919

20+
#![deny(rust_2018_idioms)]
21+
2022
#![feature(allocator_api)]
2123
#![feature(alloc)]
2224
#![feature(core_intrinsics)]
@@ -32,11 +34,6 @@
3234
#![panic_runtime]
3335
#![feature(panic_runtime)]
3436

35-
extern crate alloc;
36-
extern crate libc;
37-
#[cfg(not(any(target_env = "msvc", all(windows, target_arch = "x86_64", target_env = "gnu"))))]
38-
extern crate unwind;
39-
4037
use alloc::boxed::Box;
4138
use core::intrinsics;
4239
use core::mem;
@@ -87,7 +84,7 @@ pub unsafe extern "C" fn __rust_maybe_catch_panic(f: fn(*mut u8),
8784
vtable_ptr: *mut usize)
8885
-> u32 {
8986
let mut payload = imp::payload();
90-
if intrinsics::try(f, data, &mut payload as *mut _ as *mut _) == 0 {
87+
if intrinsics::r#try(f, data, &mut payload as *mut _ as *mut _) == 0 {
9188
0
9289
} else {
9390
let obj = mem::transmute::<_, raw::TraitObject>(imp::cleanup(payload));

src/libpanic_unwind/seh.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ use core::any::Any;
5252
use core::mem;
5353
use core::raw;
5454

55-
use windows as c;
55+
use crate::windows as c;
5656
use libc::{c_int, c_uint};
5757

5858
// 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> {
301301
#[lang = "eh_personality"]
302302
#[cfg(not(test))]
303303
fn rust_eh_personality() {
304-
unsafe { ::core::intrinsics::abort() }
304+
unsafe { core::intrinsics::abort() }
305305
}

src/libpanic_unwind/seh64_gnu.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use alloc::boxed::Box;
99
use core::any::Any;
1010
use core::intrinsics;
1111
use core::ptr;
12-
use dwarf::eh::{EHContext, EHAction, find_eh_action};
13-
use windows as c;
12+
use crate::dwarf::eh::{EHContext, EHAction, find_eh_action};
13+
use crate::windows as c;
1414

1515
// Define our exception codes:
1616
// according to http://msdn.microsoft.com/en-us/library/het71c37(v=VS.80).aspx,

src/librustc_typeck/check/method/suggest.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -752,12 +752,11 @@ fn compute_all_traits<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Vec<DefId>
752752
traits: &mut Vec<DefId>,
753753
external_mods: &mut FxHashSet<DefId>,
754754
def: Def) {
755-
let def_id = def.def_id();
756755
match def {
757-
Def::Trait(..) => {
756+
Def::Trait(def_id) => {
758757
traits.push(def_id);
759758
}
760-
Def::Mod(..) => {
759+
Def::Mod(def_id) => {
761760
if !external_mods.insert(def_id) {
762761
return;
763762
}

src/librustdoc/visit_lib.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,11 @@ impl<'a, 'tcx, 'rcx> LibEmbargoVisitor<'a, 'tcx, 'rcx> {
6060
}
6161

6262
for item in self.cx.tcx.item_children(def_id).iter() {
63-
if self.cx.tcx.def_key(item.def.def_id()).parent.map_or(false, |d| d == def_id.index) ||
64-
item.vis == Visibility::Public {
65-
self.visit_item(item.def);
63+
if let Some(def_id) = item.def.opt_def_id() {
64+
if self.cx.tcx.def_key(def_id).parent.map_or(false, |d| d == def_id.index) ||
65+
item.vis == Visibility::Public {
66+
self.visit_item(item.def);
67+
}
6668
}
6769
}
6870
}

0 commit comments

Comments
 (0)