You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expected to see this happen:
No error when building my project using rustc version 1.74 like it is with 1.73 and previous versions.
Instead, this happened:
I get an error about lifetime where my parameter type T may not live long enough when building it using 1.74.
This error is not thrown on older rustc versions.
error[E0310]: the parameter type `T` may not live long enough
--> xelis_common/src/rpc_server/mod.rs:57:18
|
57 | let result = server.get_rpc_handler().handle_request(&body).await?;
| ^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound...
|
54 | T: Send + Sync + Clone + 'static,
| +++++++++
error[E0310]: the parameter type `T` may not live long enough
--> xelis_common/src/rpc_server/mod.rs:57:18
|
57 | let result = server.get_rpc_handler().handle_request(&body).await?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound...
|
54 | T: Send + Sync + Clone + 'static,
| +++++++++
For more information about this error, try `rustc --explain E0310`.
error: could not compile `xelis_common` (lib) due to 2 previous errors
The change in behavior is necessary to fix a soundness bug in Rust: In this example use_static has a T: 'static bound, but make_static does not. This is unsound, because use_static can assume that x contains no non-'static borrows, but callers of make_static do not have to promise that that is the case. (proof of unsoundness)
You likely have to add : 'static bounds like the compiler suggests to make your code sound.
Hey there,
I found a breaking change bug about lifetime where the newly stable version raise an (incorrect ?) error.
My code is basically this:
xelis_common/src/rpc_server/mod.rs:52
Where
get_rpc_handler()
come from this:xelis_common/src/rpc_server/mod.rs:47
Which expose this:
xelis_common/src/rpc_server/rpc_handler.rs:25
this function come from this struct:
xelis_common/src/rpc_server/rpc_handler.rs:9
I expected to see this happen:
No error when building my project using rustc version 1.74 like it is with 1.73 and previous versions.
Instead, this happened:
I get an error about lifetime where my parameter type T may not live long enough when building it using 1.74.
This error is not thrown on older rustc versions.
Meta
rustc --version --verbose
:Backtrace
In case you want to reproduce it:
https://github.com/xelis-project/xelis-blockchain/tree/dev
and try to compile using:
cargo build --bin xelis_daemon
In case, I'm also using tokio for async runtime.
The text was updated successfully, but these errors were encountered: