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 #87655

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add long explanation for E0726
  • Loading branch information
codekidX committed Sep 28, 2021
commit 4336f9d064f18adb9f60c431280951fcac9fd264
1 change: 1 addition & 0 deletions compiler/rustc_error_codes/src/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,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"),
Copy link
Member

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.

Suggested change
E0725: include_str!("./error_codes/E0726.md"),
E0726: 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"),
Copy link
Member

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).

Expand Down
19 changes: 19 additions & 0 deletions compiler/rustc_error_codes/src/error_codes/E0726.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
A lifetime indication has not been added to specify the span of your type.

Erroneous code example:

```rust
Copy link
Member

@GuillaumeGomez GuillaumeGomez Jul 31, 2021

Choose a reason for hiding this comment

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

Suggested change
```rust
```compile_fail,E0726

struct Abc<'a> {
title: &'a str,
}

struct SomeStruct;

impl SomeStruct {
pub fn some_fn(&self, abc: Abc) { // error: implicit elided lifetime not allowed here rustc(E0726)
// ...
}
}
```

Specify the lifetime of struct `Abc` or indicate the anonymous lifetime like `abc: Abc<'_>`.
Copy link
Member

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.

Copy link
Member

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.