Skip to content

Commit fbe17de

Browse files
committed
Merge pull request #20 from RossMeikleham/master
Fix for latest nightly lib.rs: Fix for changes to macros, and tuple indexing. tests.rs: Fix for language removal of proc, replaced with move. Replaced depreciated std::task with std::thread
2 parents 37b2d3c + 3ff8479 commit fbe17de

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub fn upvalueindex(n: i32) -> i32 {
4444
raw::lua_upvalueindex(n as c_int) as i32
4545
}
4646

47-
include!(concat!(env!("OUT_DIR"), "/config.rs"))
47+
include!(concat!(env!("OUT_DIR"), "/config.rs"));
4848

4949
#[allow(missing_docs)]
5050
pub mod raw;
@@ -2900,7 +2900,7 @@ impl<'l> RawState<'l> {
29002900
}
29012901
lstv.push(ptr::null());
29022902
let i = aux::raw::luaL_checkoption(self.L, narg as c_int, defp, lstv.as_ptr()) as uint;
2903-
lst[i].ref1()
2903+
& lst[i].1
29042904
}
29052905

29062906
pub unsafe fn ref_(&mut self, t: i32) -> i32 {

src/tests.rs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ use Type;
44
use raw;
55

66
use libc;
7-
use std::task;
7+
use std::thread::Thread;
88
use std::any::AnyRefExt;
9+
use std::any::Any;
10+
use std::sync::Arc;
911

1012
#[test]
1113
fn test_state_init() {
@@ -22,10 +24,10 @@ fn test_error() {
2224

2325
#[test]
2426
fn test_errorstr() {
25-
let res = task::try::<()>(proc() {
27+
let res : Result<(), Box<Any + Send>> = Thread::spawn(move || {
2628
let mut s = State::new();
2729
s.errorstr("some err");
28-
});
30+
}).join();
2931
let err = res.unwrap_err();
3032
let expected = "unprotected error in call to Lua API (some err)";
3133
let s = err.downcast_ref::<String>();
@@ -93,16 +95,19 @@ fn test_checkoption() {
9395
}
9496
assert_eq!(*s.checkoption(1, Some("three"), &lst), CheckOptionEnum::Three);
9597

96-
let res = task::try(proc() {
98+
let lst_arc1 = Arc::new(lst);
99+
let lst_arc2 = lst_arc1.clone();
100+
101+
let res = Thread::spawn(move || {
97102
let mut s = State::new();
98-
s.checkoption(1, None, &lst);
99-
});
103+
s.checkoption(1, None, &*lst_arc1);
104+
}).join();
100105
assert!(res.is_err(), "expected error from checkoption");
101-
102-
let res = task::try(proc() {
106+
107+
let res = Thread::spawn(move || {
103108
let mut s = State::new();
104-
s.checkoption(1, Some("four"), &lst);
105-
});
109+
s.checkoption(1, Some("four"), &*lst_arc2);
110+
}).join();
106111
assert!(res.is_err(), "expected error from checkoption");
107112
}
108113

0 commit comments

Comments
 (0)