Skip to content

Commit 60730fd

Browse files
committed
Update compile tests messages
1 parent df778b7 commit 60730fd

File tree

6 files changed

+121
-46
lines changed

6 files changed

+121
-46
lines changed

tests/compile/async_any_userdata_method.stderr

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: lifetime may not live long enough
44
9 | reg.add_async_method("t", |_, this: &String, ()| async {
55
| ___________________________________----------------------_^
66
| | | |
7-
| | | return type of closure `[async block@$DIR/tests/compile/async_any_userdata_method.rs:9:58: 12:10]` contains a lifetime `'2`
7+
| | | return type of closure `{async block@$DIR/tests/compile/async_any_userdata_method.rs:9:58: 12:10}` contains a lifetime `'2`
88
| | lifetime `'1` represents this closure's body
99
10 | | s = this;
1010
11 | | Ok(())
@@ -27,6 +27,8 @@ error[E0596]: cannot borrow `s` as mutable, as it is a captured variable in a `F
2727
error[E0597]: `s` does not live long enough
2828
--> tests/compile/async_any_userdata_method.rs:8:21
2929
|
30+
7 | let s = String::new();
31+
| - binding `s` declared here
3032
8 | let mut s = &s;
3133
| ^^ borrowed value does not live long enough
3234
9 | / reg.add_async_method("t", |_, this: &String, ()| async {

tests/compile/lua_norefunwindsafe.stderr

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,46 @@ error[E0277]: the type `UnsafeCell<mlua::lua::ExtraData>` may contain interior m
77
| required by a bound introduced by this call
88
|
99
= help: within `Lua`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<mlua::lua::ExtraData>`
10-
= note: required because it appears within the type `ArcInner<UnsafeCell<ExtraData>>`
11-
= note: required because it appears within the type `PhantomData<ArcInner<UnsafeCell<ExtraData>>>`
12-
= note: required because it appears within the type `Arc<UnsafeCell<ExtraData>>`
13-
= note: required because it appears within the type `LuaInner`
14-
= note: required because it appears within the type `ArcInner<LuaInner>`
15-
= note: required because it appears within the type `PhantomData<ArcInner<LuaInner>>`
16-
= note: required because it appears within the type `Arc<LuaInner>`
17-
= note: required because it appears within the type `Lua`
10+
note: required because it appears within the type `ArcInner<UnsafeCell<ExtraData>>`
11+
--> $RUST/alloc/src/sync.rs
12+
|
13+
| struct ArcInner<T: ?Sized> {
14+
| ^^^^^^^^
15+
note: required because it appears within the type `PhantomData<ArcInner<UnsafeCell<ExtraData>>>`
16+
--> $RUST/core/src/marker.rs
17+
|
18+
| pub struct PhantomData<T: ?Sized>;
19+
| ^^^^^^^^^^^
20+
note: required because it appears within the type `Arc<UnsafeCell<ExtraData>>`
21+
--> $RUST/alloc/src/sync.rs
22+
|
23+
| pub struct Arc<
24+
| ^^^
25+
note: required because it appears within the type `LuaInner`
26+
--> src/lua.rs
27+
|
28+
| pub struct LuaInner {
29+
| ^^^^^^^^
30+
note: required because it appears within the type `ArcInner<LuaInner>`
31+
--> $RUST/alloc/src/sync.rs
32+
|
33+
| struct ArcInner<T: ?Sized> {
34+
| ^^^^^^^^
35+
note: required because it appears within the type `PhantomData<ArcInner<LuaInner>>`
36+
--> $RUST/core/src/marker.rs
37+
|
38+
| pub struct PhantomData<T: ?Sized>;
39+
| ^^^^^^^^^^^
40+
note: required because it appears within the type `Arc<LuaInner>`
41+
--> $RUST/alloc/src/sync.rs
42+
|
43+
| pub struct Arc<
44+
| ^^^
45+
note: required because it appears within the type `Lua`
46+
--> src/lua.rs
47+
|
48+
| pub struct Lua(Arc<LuaInner>);
49+
| ^^^
1850
= note: required for `&Lua` to implement `UnwindSafe`
1951
note: required because it's used within this closure
2052
--> tests/compile/lua_norefunwindsafe.rs:7:18

tests/compile/non_send.stderr

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,25 @@ error[E0277]: `Rc<Cell<i32>>` cannot be sent between threads safely
44
11 | lua.create_function(move |_, ()| {
55
| --------------- ^-----------
66
| | |
7-
| _________|_______________within this `[closure@$DIR/tests/compile/non_send.rs:11:25: 11:37]`
7+
| _________|_______________within this `{closure@$DIR/tests/compile/non_send.rs:11:25: 11:37}`
88
| | |
99
| | required by a bound introduced by this call
1010
12 | | Ok(data.get())
1111
13 | | })?
1212
| |_____^ `Rc<Cell<i32>>` cannot be sent between threads safely
1313
|
14-
= help: within `[closure@$DIR/tests/compile/non_send.rs:11:25: 11:37]`, the trait `Send` is not implemented for `Rc<Cell<i32>>`
14+
= help: within `{closure@$DIR/tests/compile/non_send.rs:11:25: 11:37}`, the trait `Send` is not implemented for `Rc<Cell<i32>>`
1515
note: required because it's used within this closure
1616
--> tests/compile/non_send.rs:11:25
1717
|
1818
11 | lua.create_function(move |_, ()| {
1919
| ^^^^^^^^^^^^
20-
= note: required for `[closure@$DIR/tests/compile/non_send.rs:11:25: 11:37]` to implement `mlua::types::MaybeSend`
20+
= note: required for `{closure@$DIR/tests/compile/non_send.rs:11:25: 11:37}` to implement `mlua::types::MaybeSend`
2121
note: required by a bound in `Lua::create_function`
2222
--> src/lua.rs
2323
|
24+
| pub fn create_function<'lua, A, R, F>(&'lua self, func: F) -> Result<Function<'lua>>
25+
| --------------- required by a bound in this associated function
26+
...
2427
| F: Fn(&'lua Lua, A) -> Result<R> + MaybeSend + 'static,
2528
| ^^^^^^^^^ required by this bound in `Lua::create_function`

tests/compile/ref_nounwindsafe.stderr

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,57 @@ error[E0277]: the type `UnsafeCell<mlua::lua::ExtraData>` may contain interior m
77
| required by a bound introduced by this call
88
|
99
= help: within `Lua`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<mlua::lua::ExtraData>`
10-
= note: required because it appears within the type `ArcInner<UnsafeCell<ExtraData>>`
11-
= note: required because it appears within the type `PhantomData<ArcInner<UnsafeCell<ExtraData>>>`
12-
= note: required because it appears within the type `Arc<UnsafeCell<ExtraData>>`
13-
= note: required because it appears within the type `LuaInner`
14-
= note: required because it appears within the type `ArcInner<LuaInner>`
15-
= note: required because it appears within the type `PhantomData<ArcInner<LuaInner>>`
16-
= note: required because it appears within the type `Arc<LuaInner>`
17-
= note: required because it appears within the type `Lua`
10+
note: required because it appears within the type `ArcInner<UnsafeCell<ExtraData>>`
11+
--> $RUST/alloc/src/sync.rs
12+
|
13+
| struct ArcInner<T: ?Sized> {
14+
| ^^^^^^^^
15+
note: required because it appears within the type `PhantomData<ArcInner<UnsafeCell<ExtraData>>>`
16+
--> $RUST/core/src/marker.rs
17+
|
18+
| pub struct PhantomData<T: ?Sized>;
19+
| ^^^^^^^^^^^
20+
note: required because it appears within the type `Arc<UnsafeCell<ExtraData>>`
21+
--> $RUST/alloc/src/sync.rs
22+
|
23+
| pub struct Arc<
24+
| ^^^
25+
note: required because it appears within the type `LuaInner`
26+
--> src/lua.rs
27+
|
28+
| pub struct LuaInner {
29+
| ^^^^^^^^
30+
note: required because it appears within the type `ArcInner<LuaInner>`
31+
--> $RUST/alloc/src/sync.rs
32+
|
33+
| struct ArcInner<T: ?Sized> {
34+
| ^^^^^^^^
35+
note: required because it appears within the type `PhantomData<ArcInner<LuaInner>>`
36+
--> $RUST/core/src/marker.rs
37+
|
38+
| pub struct PhantomData<T: ?Sized>;
39+
| ^^^^^^^^^^^
40+
note: required because it appears within the type `Arc<LuaInner>`
41+
--> $RUST/alloc/src/sync.rs
42+
|
43+
| pub struct Arc<
44+
| ^^^
45+
note: required because it appears within the type `Lua`
46+
--> src/lua.rs
47+
|
48+
| pub struct Lua(Arc<LuaInner>);
49+
| ^^^
1850
= note: required for `&Lua` to implement `UnwindSafe`
19-
= note: required because it appears within the type `LuaRef<'_>`
20-
= note: required because it appears within the type `Table<'_>`
51+
note: required because it appears within the type `LuaRef<'_>`
52+
--> src/types.rs
53+
|
54+
| pub(crate) struct LuaRef<'lua> {
55+
| ^^^^^^
56+
note: required because it appears within the type `Table<'_>`
57+
--> src/table.rs
58+
|
59+
| pub struct Table<'lua>(pub(crate) LuaRef<'lua>);
60+
| ^^^^^
2161
note: required because it's used within this closure
2262
--> tests/compile/ref_nounwindsafe.rs:8:18
2363
|

tests/compile/scope_userdata_borrow.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ error[E0597]: `ibad` does not live long enough
44
11 | lua.scope(|scope| {
55
| ----- has type `&mlua::Scope<'_, '1>`
66
...
7+
14 | let ibad = 42;
8+
| ---- binding `ibad` declared here
79
15 | scope.create_nonstatic_userdata(MyUserData(&ibad)).unwrap();
810
| -------------------------------------------^^^^^--
911
| | |
Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,31 @@
11
error[E0597]: `lua` does not live long enough
22
--> tests/compile/static_callback_args.rs:12:5
33
|
4-
10 | let lua = Lua::new();
5-
| --- binding `lua` declared here
4+
10 | let lua = Lua::new();
5+
| --- binding `lua` declared here
66
11 |
7-
12 | / lua.create_function(|_, table: Table| {
8-
13 | |/ BAD_TIME.with(|bt| {
9-
14 | || *bt.borrow_mut() = Some(table);
10-
15 | || });
11-
| ||__________- argument requires that `lua` is borrowed for `'static`
12-
16 | | Ok(())
13-
17 | | })?
14-
| |_______^ borrowed value does not live long enough
7+
12 | lua.create_function(|_, table: Table| {
8+
| ^^^ borrowed value does not live long enough
9+
13 | / BAD_TIME.with(|bt| {
10+
14 | | *bt.borrow_mut() = Some(table);
11+
15 | | });
12+
| |__________- argument requires that `lua` is borrowed for `'static`
1513
...
16-
32 | }
17-
| - `lua` dropped here while still borrowed
14+
32 | }
15+
| - `lua` dropped here while still borrowed
1816

1917
error[E0505]: cannot move out of `lua` because it is borrowed
2018
--> tests/compile/static_callback_args.rs:22:10
2119
|
22-
10 | let lua = Lua::new();
23-
| --- binding `lua` declared here
20+
10 | let lua = Lua::new();
21+
| --- binding `lua` declared here
2422
11 |
25-
12 | / lua.create_function(|_, table: Table| {
26-
13 | |/ BAD_TIME.with(|bt| {
27-
14 | || *bt.borrow_mut() = Some(table);
28-
15 | || });
29-
| ||__________- argument requires that `lua` is borrowed for `'static`
30-
16 | | Ok(())
31-
17 | | })?
32-
| |_______- borrow of `lua` occurs here
23+
12 | lua.create_function(|_, table: Table| {
24+
| --- borrow of `lua` occurs here
25+
13 | / BAD_TIME.with(|bt| {
26+
14 | | *bt.borrow_mut() = Some(table);
27+
15 | | });
28+
| |__________- argument requires that `lua` is borrowed for `'static`
3329
...
34-
22 | drop(lua);
35-
| ^^^ move out of `lua` occurs here
30+
22 | drop(lua);
31+
| ^^^ move out of `lua` occurs here

0 commit comments

Comments
 (0)