Skip to content
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

Merged
merged 2 commits into from
Feb 28, 2022
Merged

Conversation

GuillaumeGomez
Copy link
Member

This is the cleaned up version of #87655 with the missing fixes.

Part of #61137.

r? @Urgau

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Feb 28, 2022
Copy link
Member

@Urgau Urgau left a 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!
Copy link
Member

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 ?

Suggested change
async fn create(content: Content) { // ok!
async fn create<'a>(content: Content<'a>) { // ok!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oups, good catch!

Copy link
Member Author

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
the lifetime of your type the following error occurs.
the lifetime of your type, the following error occurs.

@GuillaumeGomez
Copy link
Member Author

Thanks for the quick review!

@bors: r=Urgau rollup

@bors
Copy link
Contributor

bors commented Feb 28, 2022

📌 Commit 8f36d4a has been approved by Urgau

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Feb 28, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 28, 2022
…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
@bors bors merged commit 34657cc into rust-lang:master Feb 28, 2022
@rustbot rustbot added this to the 1.61.0 milestone Feb 28, 2022
@GuillaumeGomez GuillaumeGomez deleted the explanation-e0726 branch March 1, 2022 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants