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 RustcVacantEntry::insert_entry for rust-lang/rust#64656 #118

Merged
merged 2 commits into from
Oct 4, 2019
Merged

Add RustcVacantEntry::insert_entry for rust-lang/rust#64656 #118

merged 2 commits into from
Oct 4, 2019

Conversation

passcod
Copy link
Contributor

@passcod passcod commented Sep 30, 2019

See rust-lang/rust#64656.

This was based on v0.5.0 as that's what rustc uses; I can rebase onto master, but I'm not sure whether rustc wants v0.6.0 or if v0.6.0 is rustc-ready.

For context, this ultimately provides an API with this shape:

impl Entry<'a, K, V> {
    fn insert(self, value: V) -> OccupiedEntry<'a, K, V> {}
}

to be used when one wants to insert a value without consuming the Entry, e.g. because one wants to keep a reference to the key around. There's more at the original (defunct) PR: rust-lang/rust#60142.

@passcod passcod changed the title Map entry insert Add RustcVacantEntry::insert_and_return for rust-lang/rustc#64656 Sep 30, 2019
@passcod passcod changed the title Add RustcVacantEntry::insert_and_return for rust-lang/rustc#64656 Add RustcVacantEntry::insert_and_return for rust-lang/rust#64656 Sep 30, 2019
@Amanieu
Copy link
Member

Amanieu commented Sep 30, 2019

Please rebase onto master. Also you'll want to run rustfmt.

@Amanieu
Copy link
Member

Amanieu commented Sep 30, 2019

There are a few CI failures, but they seem unrelated to this PR.

@Amanieu Amanieu changed the title Add RustcVacantEntry::insert_and_return for rust-lang/rust#64656 Add RustcVacantEntry::insert_entry for rust-lang/rust#64656 Sep 30, 2019
@passcod
Copy link
Contributor Author

passcod commented Sep 30, 2019

I can implement the insert method for the other public Entry APIs in this crate if wanted?

Done.

@passcod
Copy link
Contributor Author

passcod commented Oct 4, 2019

Do I need to do anything for this to go further?

@Amanieu
Copy link
Member

Amanieu commented Oct 4, 2019

I'm just waiting for #120 to land before merging this.

@passcod
Copy link
Contributor Author

passcod commented Oct 4, 2019

Ah, thanks!

@Amanieu
Copy link
Member

Amanieu commented Oct 4, 2019

@bors r+

@bors
Copy link
Contributor

bors commented Oct 4, 2019

📌 Commit ecbdeb9 has been approved by Amanieu

@bors
Copy link
Contributor

bors commented Oct 4, 2019

⌛ Testing commit ecbdeb9 with merge 62a1ae2...

bors added a commit that referenced this pull request Oct 4, 2019
Add RustcVacantEntry::insert_entry for rust-lang/rust#64656

See rust-lang/rust#64656.

~~This was based on v0.5.0 as that's what rustc uses; I can rebase onto master, but I'm not sure whether rustc wants v0.6.0 or if v0.6.0 is rustc-ready.~~

For context, this ultimately provides an API with this shape:

```rust
impl Entry<'a, K, V> {
    fn insert(self, value: V) -> OccupiedEntry<'a, K, V> {…}
}
```

to be used when one wants to insert a value without consuming the Entry, e.g. because one wants to keep a reference to the key around. There's more at the original (defunct) PR: rust-lang/rust#60142.
@bors
Copy link
Contributor

bors commented Oct 4, 2019

☀️ Test successful - checks-travis
Approved by: Amanieu
Pushing 62a1ae2 to master...

@bors bors merged commit ecbdeb9 into rust-lang:master Oct 4, 2019
@passcod passcod deleted the map-entry-insert branch October 4, 2019 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants