-
Notifications
You must be signed in to change notification settings - Fork 13k
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 #87655
Conversation
Some changes occurred in diagnostic error codes |
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @LeSeulArtichaut (or someone else) soon. Please see the contribution instructions for more information. |
|
||
Erroneous code example: | ||
|
||
```rust |
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.
```rust | |
```compile_fail,E0726 |
} | ||
``` | ||
|
||
Specify the lifetime of struct `Abc` or indicate the anonymous lifetime like `abc: Abc<'_>`. |
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 explanation is a bit lacking no? Maybe try to explain a bit more.
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.
Also, please add a working version of the code example from above.
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 explanation needs to be extending (lifetimes are far from an easy topic in rust) and you also need to add a working version of your previous failing code example.
@@ -423,6 +423,7 @@ E0720: include_str!("./error_codes/E0720.md"), | |||
E0722: include_str!("./error_codes/E0722.md"), | |||
E0724: include_str!("./error_codes/E0724.md"), | |||
E0725: include_str!("./error_codes/E0725.md"), | |||
E0725: include_str!("./error_codes/E0726.md"), | |||
E0727: include_str!("./error_codes/E0727.md"), | |||
E0728: include_str!("./error_codes/E0728.md"), | |||
E0729: include_str!("./error_codes/E0729.md"), |
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.
You need to remove E0725 from the list of error codes from below (it's not supposed to be declared twice in this file).
@@ -423,6 +423,7 @@ E0720: include_str!("./error_codes/E0720.md"), | |||
E0722: include_str!("./error_codes/E0722.md"), | |||
E0724: include_str!("./error_codes/E0724.md"), | |||
E0725: include_str!("./error_codes/E0725.md"), | |||
E0725: include_str!("./error_codes/E0726.md"), |
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.
It's also 726 and not 725.
E0725: include_str!("./error_codes/E0726.md"), | |
E0726: include_str!("./error_codes/E0726.md"), |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@GuillaumeGomez does |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
hey @GuillaumeGomez, I have added detailed explanation, please take a look. Also the test is failing as
it should be
right? Since its itself |
@@ -0,0 +1,47 @@ | |||
When a struct or a type is bound/declared with a lifetime it is important for |
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.
Please write a short summary of the error here, the explanation goes below. :)
Something like "An argument's lifetime was elided in an async function".
In For the failing ui test, simply run it with |
struct Blog; | ||
|
||
impl Blog { | ||
pub async fn create(content: Content) { // error: implicit elided |
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.
Why do you need a method btw? Shouldn't an async function be enough?
} | ||
} | ||
|
||
fn main() { |
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.
No need to declare a main
function, please remove it (but keep its content!).
`pub async fn create<'a>(content: Content<'a>) {}` is not allowed here as | ||
lifetime of the `content` can differ from current context. | ||
|
||
Know more about lifetime elision in this |
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.
Please add a working version of your example above.
☔ The latest upstream changes (presumably #87697) made this pull request unmergeable. Please resolve the merge conflicts. |
Ping from triage: |
Ping again from triage: |
@JohnCSimon I'll rebase and resolve comments by today. Had some busy weeks, thanks for waiting. |
This comment has been minimized.
This comment has been minimized.
The job Click to see the possible cause of the failure (guessed by this bot)
|
☔ The latest upstream changes (presumably #90616) made this pull request unmergeable. Please resolve the merge conflicts. |
Hi @apiraino, why did you add T-rustdoc here? This is a compiler error, rustdoc doesn't introduce any error codes that I know of. |
@jyn514 I sweep the repository and assign the relevant I probably didn't have clear the context and having seen a review from Guillaume tricked me into assuming that t-rustdoc had a say on this. Sorry, I hope that didn't cause any issue! |
@apiraino no worries, I changed it to the right label :) |
bump! |
…=Urgau Add long explanation for E0726 This is the cleaned up version of rust-lang#87655 with the missing fixes. Part of rust-lang#61137. r? `@Urgau`
Hey, I think some refactoring of codebase has occurred so the guidance mentioned in #61137 is not updated I think @GuillaumeGomez .
Please let me know if any other changes needs to be added to this PR.