Skip to content

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

Merged
bors merged 2 commits into
rust-lang:masterfrom
passcod:map-entry-insert
Oct 4, 2019
Merged

Add RustcVacantEntry::insert_entry for rust-lang/rust#64656#118
bors merged 2 commits into
rust-lang:masterfrom
passcod:map-entry-insert

Conversation

@passcod

@passcod passcod commented Sep 30, 2019

Copy link
Copy Markdown
Contributor

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

Amanieu commented Sep 30, 2019

Copy link
Copy Markdown
Member

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

@Amanieu

Amanieu commented Sep 30, 2019

Copy link
Copy Markdown
Member

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

passcod commented Sep 30, 2019

Copy link
Copy Markdown
Contributor Author

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

Done.

@passcod

passcod commented Oct 4, 2019

Copy link
Copy Markdown
Contributor Author

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

@Amanieu

Amanieu commented Oct 4, 2019

Copy link
Copy Markdown
Member

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

@passcod

passcod commented Oct 4, 2019

Copy link
Copy Markdown
Contributor Author

Ah, thanks!

@Amanieu

Amanieu commented Oct 4, 2019

Copy link
Copy Markdown
Member

@bors r+

@bors

bors commented Oct 4, 2019

Copy link
Copy Markdown
Contributor

📌 Commit ecbdeb9 has been approved by Amanieu

@bors

bors commented Oct 4, 2019

Copy link
Copy Markdown
Contributor

⌛ 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

bors commented Oct 4, 2019

Copy link
Copy Markdown
Contributor

☀️ 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