Uh oh!
There was an error while loading. Please reload this page.
Don't provide hint to add lifetime on impl items - #37481
Conversation
rust-highfive
commented
Oct 30, 2016
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @eddyb (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
8b3646f to
b00ad7bCompareThere was a problem hiding this comment.
I think you can just add an early return here and that might be enough. Also this should only be done if the impl is for a trait, not inherent.
There was a problem hiding this comment.
- Changed to early return
- Check that impl if for a trait
- Add unittest
d45f985 to
0c4104aCompareeddyb
commented
Nov 10, 2016
@bors r+ |
bors
commented
Nov 10, 2016
📌 Commit 0c4104a has been approved by |
bors
commented
Nov 10, 2016
⌛ Testing commit 0c4104a with merge 6b14097... |
bors
commented
Nov 10, 2016
💔 Test failed - auto-win-gnu-32-opt-rustbuild |
0c4104a to
3e83628Comparealexcrichton
commented
Nov 10, 2016
@estebank looks like the travis failures are legit? |
estebank
commented
Nov 10, 2016
@alexcrichton Yes. I'll fix tonight. I need a new r+ after pushing a fix, right? |
alexcrichton
commented
Nov 10, 2016
@estebank indeed! |
Don't provide hint to add lifetime on impl items that implement a trait.
```rust
use std::str::FromStr;
pub struct Foo<'a> {
field: &'a str,
}
impl<'a> FromStr for Foo<'a> {
type Err = ();
fn from_str(path: &str) -> Result<Self, ()> {
Ok(Foo { field: path })
}
}
```
would give the following hint:
```nocode
help: consider using an explicit lifetime parameter as shown: fn from_str(path: &'a str) -> Result<Self, ()>
--> <anon>:9:5
|
9 | fn from_str(path: &str) -> Result<Self, ()> {
| ^
```
which is never correct, since then there will be a lifetime mismatch
between the impl and the trait.
Remove this hint for impl items that implement a trait.3e83628 to
87b6d38Compareestebank
commented
Nov 11, 2016
@alexcrichton@eddyb fixed the test error. |
alexcrichton
commented
Nov 11, 2016
@bors: r=eddyb |
bors
commented
Nov 11, 2016
📌 Commit 87b6d38 has been approved by |
…impl, r=eddyb
Don't provide hint to add lifetime on impl items
``` rust
use std::str::FromStr;
pub struct Foo<'a> {
field: &'a str,
}
impl<'a> FromStr for Foo<'a> {
type Err = ();
fn from_str(path: &str) -> Result<Self, ()> {
Ok(Foo { field: path })
}
}
```
would give the following hint:
``` nocode
help: consider using an explicit lifetime parameter as shown: fn from_str(path: &'a str) -> Result<Self, ()>
--> <anon>:9:5
|
9 | fn from_str(path: &str) -> Result<Self, ()> {
| ^
```
which is never correct, since then there will be a lifetime mismatch between the `impl` and the trait.
Remove this hint for all `impl` items.
Re: rust-lang#37363.bors
commented
Nov 12, 2016
⌛ Testing commit 87b6d38 with merge 65ba338... |
…impl, r=eddyb
Don't provide hint to add lifetime on impl items
``` rust
use std::str::FromStr;
pub struct Foo<'a> {
field: &'a str,
}
impl<'a> FromStr for Foo<'a> {
type Err = ();
fn from_str(path: &str) -> Result<Self, ()> {
Ok(Foo { field: path })
}
}
```
would give the following hint:
``` nocode
help: consider using an explicit lifetime parameter as shown: fn from_str(path: &'a str) -> Result<Self, ()>
--> <anon>:9:5
|
9 | fn from_str(path: &str) -> Result<Self, ()> {
| ^
```
which is never correct, since then there will be a lifetime mismatch between the `impl` and the trait.
Remove this hint for all `impl` items.
Re: rust-lang#37363.bors
commented
Nov 12, 2016
⛄ The build was interrupted to prioritize another pull request. |
Rollup of 30 pull requests - Successful merges: #37190, #37368, #37481, #37503, #37527, #37535, #37551, #37584, #37600, #37613, #37615, #37659, #37662, #37669, #37682, #37688, #37690, #37692, #37693, #37694, #37695, #37696, #37698, #37699, #37705, #37708, #37709, #37716, #37724, #37727 - Failed merges: #37640, #37689, #37717
would give the following hint:
which is never correct, since then there will be a lifetime mismatch between the
impland the trait.Remove this hint for all
implitems.Re: #37363.