kennytm
d1744728a0
Rollup merge of #59082 - alexreg:cosmetic-2-doc-comments, r=Centril
...
A few improvements to comments in user-facing crates
Not too many this time, and all concern comments (almost all doc comments) in user-facing crates (libstd, libcore, liballoc).
r? @steveklabnik
2019-03-16 22:39:56 +08:00
Alexander Regueiro
8629fd3e4e
Improvements to comments in libstd, libcore, liballoc.
2019-03-11 02:25:44 +00:00
Scott McMurray
df4ea90b39
Use lifetime contravariance to elide more lifetimes in core+alloc+std
2019-03-09 19:10:28 -08:00
Pietro Albini
55dc386f61
Rollup merge of #58369 - nox:sync-hash-map-entry, r=Amanieu
...
Make the Entry API of HashMap<K, V> Sync and Send
Fixes #45219
2019-03-08 09:41:42 +01:00
Anthony Ramine
1fec8c2835
Make the Entry API of HashMap<K, V> Sync and Send ( fixes #45219 )
2019-03-04 10:20:40 +01:00
Taiki Endo
93b6d9e086
libstd => 2018
2019-02-28 04:06:15 +09:00
Mazdak Farrokhzad
03acebe2ca
Rollup merge of #58370 - nox:relax-bounds, r=dtolnay
...
Relax some Hash bounds on HashMap<K, V, S> and HashSet<T, S>
Notably, hash iterators don't require any trait bounds to be iterated.
2019-02-25 03:17:58 +01:00
kennytm
e3a8f7db47
Rollup merge of #58553 - scottmcm:more-ihle, r=Centril
...
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 https://github.com/rust-lang/rust/pull/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 https://github.com/rust-lang/rust/issues/41960#issuecomment-464557423
2019-02-20 11:59:10 +08:00
Scott McMurray
3bea2ca49d
Use more impl header lifetime elision
...
There are two big categories of changes in here
- Removing lifetimes from common traits that can essentially never user a lifetime from an input (particularly `Drop` & `Debug`)
- 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.
2019-02-17 19:42:36 -08:00
Anthony Ramine
d9e2259d65
Relax some Hash bounds on HashMap<K, V, S> and HashSet<T, S>
...
Notably, hash iterators don't require any trait bounds to be iterated.
2019-02-13 12:23:14 +01:00
Alexander Regueiro
99ed06eb88
libs: doc comments
2019-02-10 23:57:25 +00:00
Stein Somers
8823bf0b40
Fix poor worst case performance of is_disjoint
2019-01-09 22:19:54 +01:00
Stein Somers
ccba43df81
Merge remote-tracking branch 'upstream/master'
2019-01-09 15:15:18 +01:00
Wiktor Kuchta
190d139f3a
Fix repeated word typos
...
Found with `git grep -P '\b([a-z]+)\s+\1\b'`
2019-01-03 21:33:37 +01:00
bors
ee49bf8964
Auto merge of #55519 - fhartwig:hashmap-index-example, r=Centril
...
Add example of using the indexing operator to HashMap docs
Fixes #52575
2018-12-28 06:52:15 +00:00
Mark Rousskov
2a663555dd
Remove licenses
2018-12-25 21:08:33 -07:00
kennytm
bba398ee2c
Rollup merge of #57050 - RyanMarcus:master, r=zackmdavis
...
Fixed typo in HashMap documentation
Previously "with a custom type as key", now "with a custom key type"
2018-12-23 02:12:25 +08:00
Ryan Marcus
51e4c1f320
Fixed typo in HashMap documentation
...
Previously "with a custom type as key", now "with a custom key type"
2018-12-21 14:50:25 -05:00
Stein Somers
f9f71cc324
Fix poor worst case performance of set intersection (and union, somewhat) on asymmetrically sized sets and extend unit tests slightly beyond that
2018-12-21 14:57:56 +01:00
John Kåre Alsaker
4f30a24e42
Inline tweaks
2018-12-21 12:09:43 +01:00
Alexander Regueiro
ee89c088b0
Various minor/cosmetic improvements to code
2018-12-07 23:53:34 +00:00
kennytm
06f3b57633
Rollup merge of #56561 - Zoxc:too-raw, r=Gankro
...
Fix bug in from_key_hashed_nocheck
2018-12-07 12:42:35 +08:00
John Kåre Alsaker
7df4b812f0
Fix bug in from_key_hashed_nocheck
2018-12-06 14:32:00 +01:00
Corey Farwell
c025d61409
Replace usages of ..i + 1 ranges with ..=i.
2018-12-04 12:05:19 -08:00
Hidehito Yabuuchi
1e18cc916f
Update issue number of shrink_to methods to point the tracking issue
2018-12-02 16:08:08 +09:00
John Kåre Alsaker
946ea1453d
Inline things
2018-11-30 08:14:22 +01:00
Steven Fackler
d0f99ddefa
Fix the tracking issue for hash_raw_entry
...
It used to point to the implementation PR.
2018-11-22 09:52:24 -07:00
Guillaume Gomez
89e0fcee40
Rollup merge of #55784 - meltinglava:master, r=KodrAus
...
Clarifying documentation for collections::hash_map::Entry::or_insert
Previous version does not show that or_insert does not insert the passed value, as the passed value was the same value as what was already in the map.
2018-11-22 10:37:46 +01:00
Andy Russell
4e35cbb22e
fix various typos in doc comments
2018-11-13 14:45:31 -05:00
Meltinglava
8b750a77fc
The example values are now easyer to differenciate
2018-11-13 12:20:23 +01:00
Meltinglava
b937be87cb
Clarifying documentation for collections::hash_map::Entry::or_insert
...
Previous version does not show that or_insert does not insert the
passed value, as the passed value was the same value as what was
already in the map.
2018-11-08 15:43:18 +01:00
kennytm
9d9146ad95
Rollup merge of #55734 - teresy:shorthand-fields, r=davidtwco
...
refactor: use shorthand fields
refactor: use shorthand for single fields everywhere (excluding tests).
2018-11-07 21:27:00 +08:00
teresy
eca11b99a7
refactor: use shorthand fields
2018-11-06 15:05:44 -05:00
bors
e800988579
Auto merge of #54043 - fintelia:raw_entry, r=alexcrichton
...
Add raw_entry API to HashMap
This is a continuation of #50821 .
2018-11-02 07:04:07 +00:00
Jonathan Behrens
daf5bd564a
A couple suggested edits
2018-10-31 15:15:20 -04:00
Florian Hartwig
51fdc2bf14
Add example of using the indexing operator to HashMap docs
2018-10-30 23:31:13 +01:00
bors
8a2dec6e58
Auto merge of #53804 - RalfJung:ptr-invalid, r=nagisa
...
fix some uses of pointer intrinsics with invalid pointers
[Found by miri](https://github.com/solson/miri/pull/446 ):
* `Vec::into_iter` calls `ptr::read` (and the underlying `copy_nonoverlapping`) with an unaligned pointer to a ZST. [According to LLVM devs](https://bugs.llvm.org/show_bug.cgi?id=38583 ), this is UB because it contradicts the metadata we are attaching to that pointer.
* `HashMap` creation calls `ptr:.write_bytes` on a NULL pointer with a count of 0. This is likely not currently UB *currently*, but it violates the rules we are setting in https://github.com/rust-lang/rust/pull/53783 , and we might want to exploit those rules later (e.g. with more `nonnull` attributes for LLVM).
Probably what `HashMap` really should do is use `NonNull::dangling()` instead of 0 for the empty case, but that would require a more careful analysis of the code.
It seems like ideally, we should do a review of usage of such intrinsics all over libstd to ensure that they use valid pointers even when the size is 0. Is it worth opening an issue for that?
2018-09-16 18:03:39 +00:00
Jonathan Behrens
a92594dfac
Entry is an enum not a struct
2018-09-13 21:21:53 -04:00
Jonathan Behrens
7220fbb713
Fix links in docs
2018-09-13 19:05:41 -04:00
Jonathan Behrens
e9583628b2
Eliminate unused variable warning
2018-09-13 16:48:09 -04:00
Jonathan Behrens
dc41726de3
Fix tests and update issue number
2018-09-13 16:19:40 -04:00
Jonathan Behrens
1ad0919fa9
Remove println!() statement from HashMap unit test
2018-09-13 14:58:13 -04:00
Jonathan Behrens
2c0f385d0c
Fix formatting
2018-09-12 14:59:12 -04:00
Val
abe0f027ae
fix typos in growth algo description
...
modified to read "the first table overflows into the second, and the second into the first." plus smaller typos
2018-09-10 09:02:16 -07:00
Jonathan Behrens
ad6c7a9a31
Cleanup API somewhat
2018-09-07 16:47:19 -04:00
Guillaume Gomez
c1ad1b0338
Fix invalid urls
2018-09-06 23:32:30 +02:00
Alexis Beingessner
6089af72c0
disambiguate hashes
2018-09-05 12:10:09 -04:00
Alexis Beingessner
14ee4e468d
fixup Debug bounds
2018-09-05 12:10:09 -04:00
Alexis Beingessner
9c566e64fa
progress on raw_entry
2018-09-05 12:10:09 -04:00
Alexis Beingessner
6af55a7c61
WIP: add raw_entry API to HashMap
2018-09-05 12:10:09 -04:00