Skip to content

Commit db68d22

Browse files
committed
Fix the compile-fail tests, as of rust 1.52.1.
The compiler error messages have improved. Also fix a warning in the userdata tests.
1 parent 999177f commit db68d22

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

tests/compile-fail/context_nounwindsafe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rlua::Lua;
77
fn main() {
88
Lua::new().context(|lua| {
99
catch_unwind(move || {
10-
//~^ error: the type `std::cell::UnsafeCell<()>` may contain interior mutability and a reference
10+
//~^ error: the type `UnsafeCell<()>` may contain interior mutability and a reference
1111
// may not be safely transferrable across a catch_unwind boundary
1212
lua.create_table().unwrap();
1313
});

tests/compile-fail/lua_norefunwindsafe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rlua::Lua;
77
fn main() {
88
let lua = Lua::new();
99
catch_unwind(|| {
10-
//~^ error: the type `std::cell::UnsafeCell<()>` may contain interior mutability and a reference
10+
//~^ error: the type `UnsafeCell<()>` may contain interior mutability and a reference
1111
// may not be safely transferrable across a catch_unwind boundary
1212
lua.context(|lua| {
1313
lua.create_table().unwrap();

tests/compile-fail/scope_callback_capture.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ fn main() {
1111
lua.scope(|scope| {
1212
let mut inner: Option<Table> = None;
1313
let f = scope
14+
//~^ error: borrowed data escapes outside of closure
1415
.create_function_mut(move |lua, t: Table| {
15-
//~^ error: cannot infer an appropriate lifetime for autoref due to conflicting
16-
// requirements
1716
if let Some(old) = inner.take() {
1817
// Access old callback `Lua`.
1918
}

tests/compile-fail/scope_callback_inner.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ fn main() {
1111
lua.scope(|scope| {
1212
let mut inner: Option<Table> = None;
1313
let f = scope
14+
//~^ error: borrowed data escapes outside of closure
1415
.create_function_mut(|_, t: Table| {
15-
//~^ error: cannot infer an appropriate lifetime for autoref due to conflicting
16-
// requirements
16+
//~^ error: closure may outlive the current function, but it borrows `inner`
1717
inner = Some(t);
1818
Ok(())
1919
})

tests/compile-fail/scope_callback_outer.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ fn main() {
1111
let mut outer: Option<Table> = None;
1212
lua.scope(|scope| {
1313
let f = scope
14+
//~^ error: borrowed data escapes outside of closure
1415
.create_function_mut(|_, t: Table| {
15-
//~^^ error: borrowed data cannot be stored outside of its closure
1616
outer = Some(t);
17+
//~^ error: `outer` does not live long enough
1718
Ok(())
1819
})
1920
.unwrap();

tests/userdata.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ fn test_user_data() {
1010
struct UserData1(i64);
1111
struct UserData2(Box<i64>);
1212

13-
impl UserData for UserData1 {};
14-
impl UserData for UserData2 {};
13+
impl UserData for UserData1 {}
14+
impl UserData for UserData2 {}
1515

1616
Lua::new().context(|lua| {
1717
let userdata1 = lua.create_userdata(UserData1(1)).unwrap();

0 commit comments

Comments
 (0)