New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incomprehensible type error when defining getter and setter #78337
Comments
|
I don't think this is actually a bug - changing it from a field to a method requires that you move the whole struct into the closure instead of just a single field. The error message is pretty bad, though. I think you can work around this with let main = this.main();
async {
tokio::spawn(main)
} |
@jyn514 Unfortunately, the same error remains. I am unable to produce a mcve, so I created a branch to isolate the issue, the code that produces the error is there: https://github.com/MarinPostma/async-raft/blob/broken-rust/async-raft/src/core/mod.rs#L105-L137. |
We have code to produce error messages which explain why a particular Future type doesn't satisfy a trait bound, like |
Triage, current output:
|
I was trying to create getter and setter for a particular field in a struct, and doing so generated a type error. Before adding the methods, the code compiled just fine, but adding them produce a type error. I'm joining the diff of the code that produced the error along with the error message. Unless I am missing something the two version ought to be strictly equivalent. This is the minimal code sample that produce the error.
Code changes
Meta
rustc --version --verbose
:Error output
The text was updated successfully, but these errors were encountered: