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

Use impl_header_lifetime_elision in libcore #54687

Merged
merged 3 commits into from
Oct 3, 2018

Conversation

scottmcm
Copy link
Member

The feature is approved for stabilization, so let's use it to remove about 300 'as.

Tracking issue for the feature: #15872

@rust-highfive
Copy link
Collaborator

r? @dtolnay

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 30, 2018
@@ -14,7 +14,7 @@ LL | impl Copy for &'static NotSync {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: conflicting implementation in crate `core`:
- impl<'a, T> std::marker::Copy for &'a T
- impl<'_, T> std::marker::Copy for &T
Copy link
Member

Choose a reason for hiding this comment

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

This line is not valid syntax. I filed #54690 to follow up.

@dtolnay
Copy link
Member

dtolnay commented Sep 30, 2018

@bors r+

@bors
Copy link
Contributor

bors commented Sep 30, 2018

📌 Commit 8d6bee3 has been approved by dtolnay

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 30, 2018
@rust-highfive

This comment has been minimized.

@kennytm kennytm added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 1, 2018
@scottmcm
Copy link
Member Author

scottmcm commented Oct 1, 2018

@dtolnay I needed to add a commit to fix the libcore test build; please re-r+

@dtolnay
Copy link
Member

dtolnay commented Oct 1, 2018

Looks good!

@bors r+

@bors
Copy link
Contributor

bors commented Oct 1, 2018

📌 Commit d4840da has been approved by dtolnay

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 1, 2018
@bors
Copy link
Contributor

bors commented Oct 1, 2018

⌛ Testing commit d4840da with merge 5ed5b3bcb5610cf0712466f4887142bb62c4ebbd...

@bors
Copy link
Contributor

bors commented Oct 1, 2018

💔 Test failed - status-appveyor

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 1, 2018
@scottmcm
Copy link
Member Author

scottmcm commented Oct 1, 2018

3hr timeout on appveyor: https://ci.appveyor.com/project/rust-lang/rust/build/1.0.9185

Can I get a retry, please?

@kennytm
Copy link
Member

kennytm commented Oct 2, 2018

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 2, 2018
pietroalbini added a commit to pietroalbini/rust that referenced this pull request Oct 2, 2018
Use impl_header_lifetime_elision in libcore

The feature is approved for stabilization, so let's use it to remove about 300 `'a`s.

Tracking issue for the feature: rust-lang#15872
pietroalbini added a commit to pietroalbini/rust that referenced this pull request Oct 2, 2018
Use impl_header_lifetime_elision in libcore

The feature is approved for stabilization, so let's use it to remove about 300 `'a`s.

Tracking issue for the feature: rust-lang#15872
bors added a commit that referenced this pull request Oct 2, 2018
Rollup of 10 pull requests

Successful merges:

 - #54269 (#53840: Consolidate pattern check errors)
 - #54458 (Allow both explicit and elided lifetimes in the same impl header)
 - #54603 (Add `crate::` to trait suggestions in Rust 2018.)
 - #54648 (Update Cargo's submodule)
 - #54680 (make run-pass tests with empty main just compile-pass tests)
 - #54687 (Use impl_header_lifetime_elision in libcore)
 - #54699 (Re-export `getopts` so custom drivers can reference it.)
 - #54702 (do not promote comparing function pointers)
 - #54728 (Renumber `proc_macro` tracking issues)
 - #54745 (make `CStr::from_bytes_with_nul_unchecked()` a const fn)

Failed merges:

r? @ghost
@bors bors merged commit d4840da into rust-lang:master Oct 3, 2018
@scottmcm scottmcm deleted the more-elision branch October 3, 2018 06:26
bors added a commit that referenced this pull request Oct 23, 2018
Stabilize impl_header_lifetime_elision in 2015

~~This is currently blocked on #54902; it should be good after that~~

It's already stable in 2018; this finishes the stabilization.

FCP completed (#15872 (comment)), proposal (#15872 (comment)).

Tracking issue: #15872
Usage examples (from libcore): #54687
kennytm added a commit to kennytm/rust that referenced this pull request Feb 20, 2019
Use more impl header lifetime elision

Inspired by seeing explicit lifetimes on these two:

- https://doc.rust-lang.org/nightly/std/slice/struct.Iter.html#impl-FusedIterator
- https://doc.rust-lang.org/nightly/std/primitive.u32.html#impl-Not

And a follow-up to rust-lang#54687, that started using IHLE in libcore.

Most of the changes in here fall into two big categories:

- Removing lifetimes from common traits that can essentially never user a lifetime from an input (particularly `Drop`, `Debug`, and `Clone`)

- Forwarding impls that are only possible because the lifetime doesn't matter (like `impl<R: Read + ?Sized> Read for &mut R`)

I omitted things that seemed like they could be more controversial, like the handful of iterators that have a `Item: 'static` despite the iterator having a lifetime or the `PartialEq` implementations [where the flipped one cannot elide the lifetime](https://internals.rust-lang.org/t/impl-type-parameter-aliases/9403/2?u=scottmcm).

I also removed two lifetimes that turned out to be completely unused; see rust-lang#41960 (comment)
cuviper pushed a commit to cuviper/rayon-hash that referenced this pull request Apr 25, 2019
Use more impl header lifetime elision

Inspired by seeing explicit lifetimes on these two:

- https://doc.rust-lang.org/nightly/std/slice/struct.Iter.html#impl-FusedIterator
- https://doc.rust-lang.org/nightly/std/primitive.u32.html#impl-Not

And a follow-up to rust-lang/rust#54687, that started using IHLE in libcore.

Most of the changes in here fall into two big categories:

- Removing lifetimes from common traits that can essentially never user a lifetime from an input (particularly `Drop`, `Debug`, and `Clone`)

- Forwarding impls that are only possible because the lifetime doesn't matter (like `impl<R: Read + ?Sized> Read for &mut R`)

I omitted things that seemed like they could be more controversial, like the handful of iterators that have a `Item: 'static` despite the iterator having a lifetime or the `PartialEq` implementations [where the flipped one cannot elide the lifetime](https://internals.rust-lang.org/t/impl-type-parameter-aliases/9403/2?u=scottmcm).

I also removed two lifetimes that turned out to be completely unused; see rust-lang/rust#41960 (comment)
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants