Skip to content

Commit fcfe0de

Browse files
committed
Bump edition to 2018
1 parent 458ed98 commit fcfe0de

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "objc_exception"
33
version = "0.1.2"
44
authors = ["Steven Sheldon"]
5+
edition = "2018"
56

67
description = "Rust interface for Objective-C's throw and try/catch statements."
78
keywords = ["objective-c", "osx", "ios"]

src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ extern { }
1414

1515
extern {
1616
fn RustObjCExceptionThrow(exception: *mut c_void);
17-
fn RustObjCExceptionTryCatch(try: extern fn(*mut c_void),
17+
fn RustObjCExceptionTryCatch(r#try: extern fn(*mut c_void),
1818
context: *mut c_void, error: *mut *mut c_void) -> u8; // std::os::raw::c_uchar
1919
}
2020

@@ -64,7 +64,7 @@ unsafe fn try_no_ret<F>(closure: F) -> Result<(), *mut Exception>
6464
///
6565
/// Unsafe because this encourages unwinding through the closure from
6666
/// Objective-C, which is not safe.
67-
pub unsafe fn try<F, R>(closure: F) -> Result<R, *mut Exception>
67+
pub unsafe fn r#try<F, R>(closure: F) -> Result<R, *mut Exception>
6868
where F: FnOnce() -> R {
6969
let mut value = None;
7070
let result = {
@@ -82,13 +82,13 @@ mod tests {
8282
use alloc::string::ToString;
8383
use core::ptr;
8484

85-
use super::{throw, try};
85+
use super::{r#try, throw};
8686

8787
#[test]
8888
fn test_try() {
8989
unsafe {
9090
let s = "Hello".to_string();
91-
let result = try(move || {
91+
let result = r#try(move || {
9292
if s.len() > 0 {
9393
throw(ptr::null_mut());
9494
}
@@ -97,7 +97,7 @@ mod tests {
9797
assert!(result.unwrap_err() == ptr::null_mut());
9898

9999
let mut s = "Hello".to_string();
100-
let result = try(move || {
100+
let result = r#try(move || {
101101
s.push_str(", World!");
102102
s
103103
});

0 commit comments

Comments
 (0)