Temporary drop "compile-fail" tests due to unstable compiletest_rs crate

This commit is contained in:
Alex Orlenko 2019-09-30 22:34:20 +01:00
parent 2ca4273ffb
commit 11e22d1cba
12 changed files with 0 additions and 216 deletions

View File

@ -25,7 +25,6 @@ pkg-config = { version = "0.3.11" }
[dev-dependencies] [dev-dependencies]
rustyline = "5.0" rustyline = "5.0"
criterion = "0.2.0" criterion = "0.2.0"
compiletest_rs = { version = "0.3", features = ["stable"] }
[[bench]] [[bench]]
name = "benchmark" name = "benchmark"

View File

@ -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");
}

View File

@ -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<i32> {
//~^ error: closure may outlive the current function, but it borrows `test`, which is owned by the current function
Ok(test.0)
});
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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<Table> = 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();
});
}

View File

@ -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<Table> = 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();
});
}

View File

@ -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<Table> = 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();
});
}

View File

@ -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<Function> = 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
});
}

View File

@ -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();
});
}

View File

@ -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
};
});
}

View File

@ -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::<MyUserData>();
//~^ error: `userdata` does not live long enough
}
}