slawlor / ractor

Rust actor framework
MIT License
1.3k stars 66 forks source link

Lifetimes do not match method in trait #217

Closed simonsan closed 3 months ago

simonsan commented 3 months ago

Describe the bug

When you copy one of the examples or in general use the 'implement missing members' of rust-analyzer you'll get error[E0195]: lifetime parameters or bounds on method '<method>' do not match the trait declaration. This could be related to the removal of async_trait, I assume?

To Reproduce Steps to reproduce the behaviour:

  1. Copy example into crates main.rs
  2. run cargo check
  3. See above error.

Expected behaviour It works without manually researching on the error.

Additional context

rustc --version --verbose

rustc 1.76.0 (07dca489a 2024-02-04)
binary: rustc
commit-hash: 07dca489ac2d933c78d3c5158e3f43beefeb02ce
commit-date: 2024-02-04
host: x86_64-pc-windows-msvc
release: 1.76.0
LLVM version: 17.0.6
[package]
name = "actor-test"
version = "0.1.0"
edition = "2021"

[dependencies]
# ractor = "0.9" -> doesn't work either
ractor = { git = "https://github.com/slawlor/ractor", branch = "main" }
rand = "0.8.5"
tokio = { version = "1.36.0", default-features = false, features = ["rt-multi-thread"] }
tracing = "0.1.40"
tracing-glog = "0.3.0"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
slawlor commented 3 months ago

The reason is you haven't disabled the use of the async-trait feature on ractor, which is a default feature. If you want to use the new async fn in traits functionality, you have to bring ractor to the same.

The default mode, in order to not break backwards compatibility and while we assess the impact of not boxing the futures, is to continue using async-trait for the time being

slawlor commented 3 months ago

Related #202