diff --git a/Cargo.toml b/Cargo.toml index 6081cf8..2ff1698 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,6 @@ pkg-config = { version = "0.3.11" } [dev-dependencies] rustyline = "5.0" criterion = "0.2.0" -compiletest_rs = { version = "0.3", features = ["stable"] } [[bench]] name = "benchmark" diff --git a/tests/compile-fail.rs b/tests/compile-fail.rs deleted file mode 100644 index 4acc159..0000000 --- a/tests/compile-fail.rs +++ /dev/null @@ -1,17 +0,0 @@ -use std::path::PathBuf; - -fn run_mode(mode: &'static str) { - let mut config = compiletest_rs::Config::default(); - - config.mode = mode.parse().expect("Invalid mode"); - config.src_base = PathBuf::from(format!("tests/{}", mode)); - config.link_deps(); - config.clean_rmeta(); - - compiletest_rs::run_tests(&config); -} - -#[test] -fn compile_test() { - run_mode("compile-fail"); -} diff --git a/tests/compile-fail/function_borrow.rs b/tests/compile-fail/function_borrow.rs deleted file mode 100644 index 3f87ffe..0000000 --- a/tests/compile-fail/function_borrow.rs +++ /dev/null @@ -1,15 +0,0 @@ -extern crate rlua; - -use rlua::{Function, Lua, Result}; - -fn main() { - let lua = Lua::new(); - struct Test(i32); - - let test = Test(0); - - let func = lua.create_function(|_, ()| -> Result { - //~^ error: closure may outlive the current function, but it borrows `test`, which is owned by the current function - Ok(test.0) - }); -} diff --git a/tests/compile-fail/not_refunwindsafe.rs b/tests/compile-fail/not_refunwindsafe.rs deleted file mode 100644 index b190293..0000000 --- a/tests/compile-fail/not_refunwindsafe.rs +++ /dev/null @@ -1,12 +0,0 @@ -extern crate rlua; - -use std::panic::catch_unwind; - -use rlua::Lua; - -fn main() { - let lua = Lua::new(); - let _ = catch_unwind(|| lua.create_table().unwrap()); - //~^ error: the type `std::cell::UnsafeCell<()>` may contain interior mutability and a reference - // may not be safely transferrable across a catch_unwind boundary -} diff --git a/tests/compile-fail/ref_not_unwindsafe.rs b/tests/compile-fail/ref_not_unwindsafe.rs deleted file mode 100644 index 6d87aae..0000000 --- a/tests/compile-fail/ref_not_unwindsafe.rs +++ /dev/null @@ -1,13 +0,0 @@ -extern crate rlua; - -use std::panic::catch_unwind; - -use rlua::Lua; - -fn main() { - let lua = Lua::new(); - let table = lua.create_table().unwrap(); - let _ = catch_unwind(move || table.set("a", "b").unwrap()); - //~^ error: the type `std::cell::UnsafeCell<()>` may contain interior mutability and a reference - // may not be safely transferrable across a catch_unwind boundary -} diff --git a/tests/compile-fail/scope_callback_capture.rs b/tests/compile-fail/scope_callback_capture.rs deleted file mode 100644 index e9821c3..0000000 --- a/tests/compile-fail/scope_callback_capture.rs +++ /dev/null @@ -1,25 +0,0 @@ -extern crate rlua; - -use rlua::{Lua, Table}; - -fn main() { - struct Test { - field: i32, - } - - let lua = Lua::new(); - lua.scope(|scope| { - let mut inner: Option = None; - let f = scope - .create_function_mut(move |lua, t: Table| { - //~^ error: cannot infer an appropriate lifetime for autoref due to conflicting requirements - if let Some(old) = inner.take() { - // Access old callback `Lua`. - } - inner = Some(t); - Ok(()) - }) - .unwrap(); - f.call::<_, ()>(lua.create_table()).unwrap(); - }); -} diff --git a/tests/compile-fail/scope_callback_escape.rs b/tests/compile-fail/scope_callback_escape.rs deleted file mode 100644 index 8f0fa45..0000000 --- a/tests/compile-fail/scope_callback_escape.rs +++ /dev/null @@ -1,22 +0,0 @@ -extern crate rlua; - -use rlua::{Lua, Table}; - -fn main() { - struct Test { - field: i32, - } - - let lua = Lua::new(); - let mut outer: Option
= None; - lua.scope(|scope| { - let f = scope - .create_function_mut(|_, t: Table| { - //~^^ error: borrowed data cannot be stored outside of its closure - outer = Some(t); - Ok(()) - }) - .unwrap(); - f.call::<_, ()>(lua.create_table()).unwrap(); - }); -} diff --git a/tests/compile-fail/scope_callback_inner.rs b/tests/compile-fail/scope_callback_inner.rs deleted file mode 100644 index bf8c804..0000000 --- a/tests/compile-fail/scope_callback_inner.rs +++ /dev/null @@ -1,22 +0,0 @@ -extern crate rlua; - -use rlua::{Lua, Table}; - -fn main() { - struct Test { - field: i32, - } - - let lua = Lua::new(); - lua.scope(|scope| { - let mut inner: Option
= None; - let f = scope - .create_function_mut(|_, t: Table| { - //~^ error: cannot infer an appropriate lifetime for autoref due to conflicting requirements - inner = Some(t); - Ok(()) - }) - .unwrap(); - f.call::<_, ()>(lua.create_table()).unwrap(); - }); -} diff --git a/tests/compile-fail/scope_handle_escape.rs b/tests/compile-fail/scope_handle_escape.rs deleted file mode 100644 index 2263831..0000000 --- a/tests/compile-fail/scope_handle_escape.rs +++ /dev/null @@ -1,17 +0,0 @@ -extern crate rlua; - -use rlua::{Function, Lua}; - -fn main() { - struct Test { - field: i32, - } - - let lua = Lua::new(); - let mut outer: Option = None; - lua.scope(|scope| { - let f = scope.create_function_mut(|_, ()| Ok(())).unwrap(); - outer = Some(scope.create_function_mut(|_, ()| Ok(())).unwrap()); - //~^ error: borrowed data cannot be stored outside of its closure - }); -} diff --git a/tests/compile-fail/scope_invariance.rs b/tests/compile-fail/scope_invariance.rs deleted file mode 100644 index d5baf75..0000000 --- a/tests/compile-fail/scope_invariance.rs +++ /dev/null @@ -1,26 +0,0 @@ -extern crate rlua; - -use rlua::Lua; - -fn main() { - struct Test { - field: i32, - } - - let lua = Lua::new(); - lua.scope(|scope| { - let f = { - let mut test = Test { field: 0 }; - - scope - .create_function_mut(|_, ()| { - test.field = 42; - //~^ error: `test` does not live long enough - Ok(()) - }) - .unwrap() - }; - - f.call::<_, ()>(()).unwrap(); - }); -} diff --git a/tests/compile-fail/scope_userdata_borrow.rs b/tests/compile-fail/scope_userdata_borrow.rs deleted file mode 100644 index fbf0e59..0000000 --- a/tests/compile-fail/scope_userdata_borrow.rs +++ /dev/null @@ -1,24 +0,0 @@ -extern crate rlua; - -use rlua::{Lua, UserData}; - -fn main() { - let lua = Lua::new(); - let globals = lua.globals(); - - // Should not allow userdata borrow to outlive lifetime of AnyUserData handle - struct MyUserData<'a>(&'a i32); - impl<'a> UserData for MyUserData<'a> {}; - - let igood = 1; - - let lua = Lua::new(); - lua.scope(|scope| { - let ugood = scope.create_nonstatic_userdata(MyUserData(&igood)).unwrap(); - let ubad = { - let ibad = 42; - scope.create_nonstatic_userdata(MyUserData(&ibad)).unwrap(); - //~^ error: `ibad` does not live long enough - }; - }); -} diff --git a/tests/compile-fail/userdata_borrow.rs b/tests/compile-fail/userdata_borrow.rs deleted file mode 100644 index 88ffa5b..0000000 --- a/tests/compile-fail/userdata_borrow.rs +++ /dev/null @@ -1,22 +0,0 @@ -extern crate rlua; - -use rlua::{AnyUserData, Lua, Table, UserData}; - -fn main() { - let lua = Lua::new(); - let globals = lua.globals(); - - // Should not allow userdata borrow to outlive lifetime of AnyUserData handle - struct MyUserData; - impl UserData for MyUserData {}; - let userdata_ref; - { - let touter = globals.get::<_, Table>("touter").unwrap(); - touter - .set("userdata", lua.create_userdata(MyUserData).unwrap()) - .unwrap(); - let userdata = touter.get::<_, AnyUserData>("userdata").unwrap(); - userdata_ref = userdata.borrow::(); - //~^ error: `userdata` does not live long enough - } -}