-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Add long explanation for E0726 #94449
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Just need to fix the last example and the small nit.
lifetime of the `content` can differ from current context: | ||
|
||
```ignore (needs futures dependency) | ||
async fn create(content: Content) { // ok! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is that different from the example above who didn't compile ? Did you mean to write ?
async fn create(content: Content) { // ok! | |
async fn create<'a>(content: Content<'a>) { // ok! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oups, good catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant to write:
async fn create(content: Content<'_>) {
When a struct or a type is bound/declared with a lifetime it is important for | ||
the Rust compiler to know, on usage, the lifespan of the type. When the | ||
lifetime is not explicitly mentioned and the Rust Compiler cannot determine | ||
the lifetime of your type the following error occurs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the lifetime of your type the following error occurs. | |
the lifetime of your type, the following error occurs. |
e18ab11
to
8f36d4a
Compare
Thanks for the quick review! @bors: r=Urgau rollup |
📌 Commit 8f36d4a has been approved by |
…askrgr Rollup of 6 pull requests Successful merges: - rust-lang#92399 (fix typo in btree/vec doc: Self -> self) - rust-lang#92823 (Tweak diagnostics) - rust-lang#94248 (Fix ICE when passing block to while-loop condition) - rust-lang#94414 (Fix ICE when using Box<T, A> with large A) - rust-lang#94445 (4 - Make more use of `let_chains`) - rust-lang#94449 (Add long explanation for E0726) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This is the cleaned up version of #87655 with the missing fixes.
Part of #61137.
r? @Urgau