Skip to content

Commit 93617ee

Browse files
committed
Update trybuild (compile) messages
1 parent 171cdf1 commit 93617ee

8 files changed

Lines changed: 133 additions & 146 deletions
Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,41 @@
11
error[E0596]: cannot borrow `s` as mutable, as it is a captured variable in a `Fn` closure
22
--> tests/compile/async_any_userdata_method.rs:9:49
33
|
4-
9 | reg.add_async_method("t", |_, this, ()| async {
5-
| ^^^^^ cannot borrow as mutable
4+
8 | let mut s = &s;
5+
| ----- `s` declared here, outside the closure
6+
9 | reg.add_async_method("t", |_, this, ()| async {
7+
| ------------- ^^^^^ cannot borrow as mutable
8+
| |
9+
| in this closure
610
10 | s = &*this;
711
| - mutable borrow occurs due to use of `s` in closure
812

913
error[E0373]: async block may outlive the current function, but it borrows `this`, which is owned by the current function
1014
--> tests/compile/async_any_userdata_method.rs:9:49
1115
|
12-
9 | reg.add_async_method("t", |_, this, ()| async {
16+
9 | reg.add_async_method("t", |_, this, ()| async {
1317
| ^^^^^ may outlive borrowed value `this`
1418
10 | s = &*this;
1519
| ---- `this` is borrowed here
1620
|
1721
note: async block is returned here
1822
--> tests/compile/async_any_userdata_method.rs:9:49
1923
|
20-
9 | reg.add_async_method("t", |_, this, ()| async {
24+
9 | reg.add_async_method("t", |_, this, ()| async {
2125
| _________________________________________________^
2226
10 | | s = &*this;
2327
11 | | Ok(())
2428
12 | | });
2529
| |_________^
2630
help: to force the async block to take ownership of `this` (and any other referenced variables), use the `move` keyword
2731
|
28-
9 | reg.add_async_method("t", |_, this, ()| async move {
32+
9 | reg.add_async_method("t", |_, this, ()| async move {
2933
| ++++
3034

3135
error: lifetime may not live long enough
3236
--> tests/compile/async_any_userdata_method.rs:9:49
3337
|
34-
9 | reg.add_async_method("t", |_, this, ()| async {
38+
9 | reg.add_async_method("t", |_, this, ()| async {
3539
| ___________________________________-------------_^
3640
| | | |
3741
| | | return type of closure `{async block@$DIR/tests/compile/async_any_userdata_method.rs:9:49: 9:54}` contains a lifetime `'2`
@@ -46,35 +50,41 @@ error: lifetime may not live long enough
4650
error[E0597]: `s` does not live long enough
4751
--> tests/compile/async_any_userdata_method.rs:8:21
4852
|
49-
7 | let s = String::new();
53+
7 | let s = String::new();
5054
| - binding `s` declared here
51-
8 | let mut s = &s;
55+
8 | let mut s = &s;
5256
| ^^ borrowed value does not live long enough
53-
9 | / reg.add_async_method("t", |_, this, ()| async {
57+
9 | / reg.add_async_method("t", |_, this, ()| async {
5458
10 | | s = &*this;
5559
11 | | Ok(())
5660
12 | | });
5761
| |__________- argument requires that `s` is borrowed for `'static`
5862
13 | })
5963
| - `s` dropped here while still borrowed
64+
|
65+
note: requirement that the value outlives `'static` introduced here
66+
--> src/userdata.rs
67+
|
68+
| M: Fn(Lua, UserDataRef<T>, A) -> MR + MaybeSend + 'static,
69+
| ^^^^^^^
6070

6171
error[E0373]: closure may outlive the current function, but it borrows `s`, which is owned by the current function
6272
--> tests/compile/async_any_userdata_method.rs:9:35
6373
|
64-
9 | reg.add_async_method("t", |_, this, ()| async {
74+
9 | reg.add_async_method("t", |_, this, ()| async {
6575
| ^^^^^^^^^^^^^ may outlive borrowed value `s`
6676
10 | s = &*this;
6777
| - `s` is borrowed here
6878
|
6979
note: function requires argument type to outlive `'static`
7080
--> tests/compile/async_any_userdata_method.rs:9:9
7181
|
72-
9 | / reg.add_async_method("t", |_, this, ()| async {
82+
9 | / reg.add_async_method("t", |_, this, ()| async {
7383
10 | | s = &*this;
7484
11 | | Ok(())
7585
12 | | });
7686
| |__________^
7787
help: to force the closure to take ownership of `s` (and any other referenced variables), use the `move` keyword
7888
|
79-
9 | reg.add_async_method("t", move |_, this, ()| async {
89+
9 | reg.add_async_method("t", move |_, this, ()| async {
8090
| ++++

tests/compile/async_nonstatic_userdata.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
error: lifetime may not live long enough
22
--> tests/compile/async_nonstatic_userdata.rs:9:13
33
|
4-
7 | impl UserData for MyUserData<'_> {
4+
7 | impl UserData for MyUserData<'_> {
55
| -- lifetime `'1` appears in the `impl`'s self type
6-
8 | fn add_methods<M: UserDataMethods<Self>>(methods: &mut M) {
7-
9 | / methods.add_async_method("print", |_, data, ()| async move {
6+
8 | fn add_methods<M: UserDataMethods<Self>>(methods: &mut M) {
7+
9 | / methods.add_async_method("print", |_, data, ()| async move {
88
10 | | println!("{}", data.0);
99
11 | | Ok(())
1010
12 | | });

tests/compile/lua_norefunwindsafe.stderr

Lines changed: 51 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
1-
error[E0277]: the type `UnsafeCell<*mut lua_State>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
1+
error[E0277]: the type `UnsafeCell<mlua::state::raw::RawLua>` may contain interior mutability and a reference may not be safely transferable across a catch_unwind boundary
22
--> tests/compile/lua_norefunwindsafe.rs:7:18
33
|
44
7 | catch_unwind(|| lua.create_table().unwrap());
5-
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<*mut lua_State>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
5+
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<mlua::state::raw::RawLua>` may contain interior mutability and a reference may not be safely transferable across a catch_unwind boundary
66
| |
77
| required by a bound introduced by this call
88
|
9-
= help: within `mlua::types::sync::inner::ReentrantMutex<mlua::state::raw::RawLua>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<*mut lua_State>`
10-
note: required because it appears within the type `Cell<*mut lua_State>`
11-
--> $RUST/core/src/cell.rs
9+
= help: within `Lua`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<mlua::state::raw::RawLua>`
10+
note: required because it appears within the type `lock_api::remutex::ReentrantMutex<parking_lot::raw_mutex::RawMutex, parking_lot::remutex::RawThreadId, mlua::state::raw::RawLua>`
11+
--> $CARGO/lock_api-$VERSION/src/remutex.rs
1212
|
13-
| pub struct Cell<T: ?Sized> {
14-
| ^^^^
15-
note: required because it appears within the type `mlua::state::raw::RawLua`
16-
--> src/state/raw.rs
13+
| pub struct ReentrantMutex<R, G, T: ?Sized> {
14+
| ^^^^^^^^^^^^^^
15+
note: required because it appears within the type `alloc::sync::ArcInner<lock_api::remutex::ReentrantMutex<parking_lot::raw_mutex::RawMutex, parking_lot::remutex::RawThreadId, mlua::state::raw::RawLua>>`
16+
--> $RUST/alloc/src/sync.rs
17+
|
18+
| struct ArcInner<T: ?Sized> {
19+
| ^^^^^^^^
20+
note: required because it appears within the type `PhantomData<alloc::sync::ArcInner<lock_api::remutex::ReentrantMutex<parking_lot::raw_mutex::RawMutex, parking_lot::remutex::RawThreadId, mlua::state::raw::RawLua>>>`
21+
--> $RUST/core/src/marker.rs
1722
|
18-
| pub struct RawLua {
19-
| ^^^^^^
20-
note: required because it appears within the type `mlua::types::sync::inner::ReentrantMutex<mlua::state::raw::RawLua>`
21-
--> src/types/sync.rs
23+
| pub struct PhantomData<T: PointeeSized>;
24+
| ^^^^^^^^^^^
25+
note: required because it appears within the type `Arc<lock_api::remutex::ReentrantMutex<parking_lot::raw_mutex::RawMutex, parking_lot::remutex::RawThreadId, mlua::state::raw::RawLua>>`
26+
--> $RUST/alloc/src/sync.rs
2227
|
23-
| pub(crate) struct ReentrantMutex<T>(T);
24-
| ^^^^^^^^^^^^^^
25-
= note: required for `Rc<mlua::types::sync::inner::ReentrantMutex<mlua::state::raw::RawLua>>` to implement `RefUnwindSafe`
28+
| pub struct Arc<
29+
| ^^^
2630
note: required because it appears within the type `Lua`
2731
--> src/state.rs
2832
|
@@ -40,27 +44,45 @@ note: required by a bound in `std::panic::catch_unwind`
4044
| pub fn catch_unwind<F: FnOnce() -> R + UnwindSafe, R>(f: F) -> Result<R> {
4145
| ^^^^^^^^^^ required by this bound in `catch_unwind`
4246

43-
error[E0277]: the type `UnsafeCell<mlua::state::extra::ExtraData>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
47+
error[E0277]: the type `UnsafeCell<usize>` may contain interior mutability and a reference may not be safely transferable across a catch_unwind boundary
4448
--> tests/compile/lua_norefunwindsafe.rs:7:18
4549
|
4650
7 | catch_unwind(|| lua.create_table().unwrap());
47-
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<mlua::state::extra::ExtraData>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
51+
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<usize>` may contain interior mutability and a reference may not be safely transferable across a catch_unwind boundary
4852
| |
4953
| required by a bound introduced by this call
5054
|
51-
= help: the trait `RefUnwindSafe` is not implemented for `UnsafeCell<mlua::state::extra::ExtraData>`
52-
= note: required for `Rc<UnsafeCell<mlua::state::extra::ExtraData>>` to implement `RefUnwindSafe`
53-
note: required because it appears within the type `mlua::state::raw::RawLua`
54-
--> src/state/raw.rs
55+
= help: within `Lua`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<usize>`
56+
note: required because it appears within the type `Cell<usize>`
57+
--> $RUST/core/src/cell.rs
5558
|
56-
| pub struct RawLua {
57-
| ^^^^^^
58-
note: required because it appears within the type `mlua::types::sync::inner::ReentrantMutex<mlua::state::raw::RawLua>`
59-
--> src/types/sync.rs
59+
| pub struct Cell<T: ?Sized> {
60+
| ^^^^
61+
note: required because it appears within the type `lock_api::remutex::RawReentrantMutex<parking_lot::raw_mutex::RawMutex, parking_lot::remutex::RawThreadId>`
62+
--> $CARGO/lock_api-$VERSION/src/remutex.rs
63+
|
64+
| pub struct RawReentrantMutex<R, G> {
65+
| ^^^^^^^^^^^^^^^^^
66+
note: required because it appears within the type `lock_api::remutex::ReentrantMutex<parking_lot::raw_mutex::RawMutex, parking_lot::remutex::RawThreadId, mlua::state::raw::RawLua>`
67+
--> $CARGO/lock_api-$VERSION/src/remutex.rs
68+
|
69+
| pub struct ReentrantMutex<R, G, T: ?Sized> {
70+
| ^^^^^^^^^^^^^^
71+
note: required because it appears within the type `alloc::sync::ArcInner<lock_api::remutex::ReentrantMutex<parking_lot::raw_mutex::RawMutex, parking_lot::remutex::RawThreadId, mlua::state::raw::RawLua>>`
72+
--> $RUST/alloc/src/sync.rs
6073
|
61-
| pub(crate) struct ReentrantMutex<T>(T);
62-
| ^^^^^^^^^^^^^^
63-
= note: required for `Rc<mlua::types::sync::inner::ReentrantMutex<mlua::state::raw::RawLua>>` to implement `RefUnwindSafe`
74+
| struct ArcInner<T: ?Sized> {
75+
| ^^^^^^^^
76+
note: required because it appears within the type `PhantomData<alloc::sync::ArcInner<lock_api::remutex::ReentrantMutex<parking_lot::raw_mutex::RawMutex, parking_lot::remutex::RawThreadId, mlua::state::raw::RawLua>>>`
77+
--> $RUST/core/src/marker.rs
78+
|
79+
| pub struct PhantomData<T: PointeeSized>;
80+
| ^^^^^^^^^^^
81+
note: required because it appears within the type `Arc<lock_api::remutex::ReentrantMutex<parking_lot::raw_mutex::RawMutex, parking_lot::remutex::RawThreadId, mlua::state::raw::RawLua>>`
82+
--> $RUST/alloc/src/sync.rs
83+
|
84+
| pub struct Arc<
85+
| ^^^
6486
note: required because it appears within the type `Lua`
6587
--> src/state.rs
6688
|

0 commit comments

Comments
 (0)