async-graphql: Lifetime errors on SimpleObject
Recently came back to a project of mine, and now, whenever i compile, i get
lifetime may not live long enough
--> src/errors/form_field_error.rs:10:10
|
10 | #[derive(SimpleObject, Debug)]
| -^^^^^^^^^^^
| |
| let's call the lifetime of this reference `'2`
| let's call the lifetime of this reference `'1`
| associated function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'2`
|
= note: this error originates in the derive macro `SimpleObject` (in Nightly builds, run with -Z macro-backtrace for more info)
Specifications
- Version: 3
- Platform: Mac
- Subsystem: Actix-web
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 6
- Comments: 26 (18 by maintainers)
I can confirm the bug doesn’t appear in my setup anymore with 1.62.1 😃
https://blog.rust-lang.org/2022/07/19/Rust-1.62.1.html
Appears this issue is resolved with the latest version of stable. I upgraded and am no longer seeing the issue.
I also had this problem when I upgraded to Rust
1.62
😂My issue has a cooler number and was opened 86 days ago.
I am also having this problem on version 4 (4.0.4) without the actix-extension. I am using rustc 1.62.
The bug is only present in 1.62 it seems. I suggest anyone having this bug to either rollback temporarily to 1.61 or go to the nightly version.
I have found one issue on the rust github about a regression related to lifetimes in 1.62 but I don’t know if it’s exactly the same thing (I still didn’t manage to get a small repro for this problem 😕)
Looks like
rustc 1.64.0-nightly (38b72154d 2022-07-11)
does not have this issue.Same issue. I am using
axum
instead.This happened to me when i updated rust to version 1.62.0 this morning and it started throwing this error when i started adding a new feature.
It was fine when i tested it in the AM but started getting the error in the PM.
I downgraded to 1.61.0 and it seems to be working as expected.
Isn’t this issue a duplicate of #900 ?
Would you mind re-opening this issue ? Just so that it stays visible if someone else encounter this problem. I think this was fixed in the latest nightly version, so it might be a 1.62-only bug.
I did more investigation and this behaviour seems specific to rustc 1.62 (for my crate at least; I doesn’t have any problem on 1.61). @SorenHolstHansen what version of rust are you using ?
I tried expanding the SimpleObject macros using cargo-expand but then the errors goes away…
Here’s what I found:
Adding the
async-graphql-actix-web
crate as a dependency did not solve the problem.