diff options
| author | bors <bors@rust-lang.org> | 2015-09-22 16:24:06 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-09-22 16:24:06 +0000 |
| commit | 2a6f6f26f4d4a1e22ea5e2b4498d3245d80e8aff (patch) | |
| tree | e29f701ff5a3ec102e6c09ef2a96e1a6af919ae4 /src/libstd | |
| parent | 0c05492ee17c544600d3e1ea2740f8b398d01fc0 (diff) | |
| parent | cf102966dedaccb62c6691adb589352d2bd2629f (diff) | |
| download | rust-2a6f6f26f4d4a1e22ea5e2b4498d3245d80e8aff.tar.gz rust-2a6f6f26f4d4a1e22ea5e2b4498d3245d80e8aff.zip | |
Auto merge of #28584 - ranma42:simpler-innertry, r=alexcrichton
This simplifies a little inner_try and avoids multiple accesses to TLS.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/sys/common/unwind/mod.rs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/libstd/sys/common/unwind/mod.rs b/src/libstd/sys/common/unwind/mod.rs index 738681c3cfe..8899d1b04d8 100644 --- a/src/libstd/sys/common/unwind/mod.rs +++ b/src/libstd/sys/common/unwind/mod.rs @@ -148,15 +148,17 @@ pub unsafe fn try<F: FnOnce()>(f: F) -> Result<(), Box<Any + Send>> { // care of exposing correctly. unsafe fn inner_try(f: fn(*mut u8), data: *mut u8) -> Result<(), Box<Any + Send>> { - let prev = PANICKING.with(|s| s.get()); - PANICKING.with(|s| s.set(false)); - let ep = intrinsics::try(f, data); - PANICKING.with(|s| s.set(prev)); - if ep.is_null() { - Ok(()) - } else { - Err(imp::cleanup(ep)) - } + PANICKING.with(|s| { + let prev = s.get(); + s.set(false); + let ep = intrinsics::try(f, data); + s.set(prev); + if ep.is_null() { + Ok(()) + } else { + Err(imp::cleanup(ep)) + } + }) } fn try_fn<F: FnOnce()>(opt_closure: *mut u8) { |
