about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2019-10-13Rollup merge of #65366 - faern:source-on-intostringerror, r=blussMazdak Farrokhzad-21/+1
Implement Error::source on IntoStringError + Remove superfluous cause impls IntoStringError only implemented `Error::cause`, which is deprecated. This implemements `Error::source` instead. `Error::cause` will still work as before, thanks to the default implementation. I think this was the only/last `Error` impl in the standard library to have a cause, but not a source.
2019-10-13Rollup merge of #65336 - BO41:typo, r=petrochenkovMazdak Farrokhzad-5/+5
Fix typo in task::Waker fixes #65323 in `libstd/error.rs` there are a few mentions of `trait@Send` and `trait@Sync`. Are they wrong as well?
2019-10-13Rollup merge of #65246 - Wind-River:real_master_2, r=kennytmMazdak Farrokhzad-6/+20
vxWorks: implement get_path() and get_mode() for File fmt::Debug
2019-10-13Rollup merge of #65214 - Amanieu:cfg_atomic, r=alexcrichtonMazdak Farrokhzad-15/+17
Split non-CAS atomic support off into target_has_atomic_load_store This PR implements my proposed changes in https://github.com/rust-lang/rust/issues/32976#issuecomment-518542029 by removing `target_has_atomic = "cas"` and splitting `target_has_atomic` into two separate `cfg`s: * `target_has_atomic = 8/16/32/64/128`: This indicates the largest width that the target can atomically CAS (which implies support for all atomic operations). * ` target_has_atomic_load_store = 8/16/32/64/128`: This indicates the largest width that the target can support loading or storing atomically (but may not support CAS). cc #32976 r? @alexcrichton
2019-10-13Remove Error::cause impls equal to deafult implLinus Färnstrand-20/+0
2019-10-13Fix typos in error.rsBO41-5/+5
2019-10-13Implement Error::source on IntoStringErrorLinus Färnstrand-1/+1
IntoStringError only implemented Error::cause, which is deprecated. This implemements Error::source instead. Error::cause will still work as before, thanks to the default implementation.
2019-10-11Rollup merge of #65266 - rust-lang:must-use-join, r=dtolnayTyler Mandry-0/+1
Mark Path::join as must_use I've accidentally did `mut_path_buf.jon(a_path);`, expecting this to be an in-place modification. Seems like we can easily warn in such cases?
2019-10-11Rollup merge of #65048 - Kixunil:patch-1, r=KodrAusTyler Mandry-0/+2
Added doc about behavior of extend on HashMap It was unclear what the implementation does when it encounters existing keys. This change makes it clear by documenting the trait impl.
2019-10-11Rollup merge of #64337 - rick68:patch-17, r=Dylan-DPCTyler Mandry-4/+4
libstd: Fix typos in doc
2019-10-11Auto merge of #64716 - jonhoo:stabilize-mem-take, r=SimonSapinbors-1/+0
Stabilize mem::take (mem_take) Tracking issue: https://github.com/rust-lang/rust/issues/61129 r? @matklad
2019-10-10vxWorks: implement get_path() and get_mode() for File fmt::DebugBaoshanPang-6/+20
2019-10-10Mark Path::join as must_useAleksey Kladov-0/+1
I've accidentally did `mut_path_buf.jon(a_path);`, expecting this to be an in-place modification. Seems like we can easily warn in such cases?
2019-10-09Auto merge of #65228 - Wind-River:real_master, r=dtolnaybors-1/+1
vxworks: add checking (r == 0)
2019-10-09Rollup merge of #64656 - passcod:map-entry-insert, r=AmanieuMazdak Farrokhzad-1/+48
Implement (HashMap) Entry::insert as per #60142 Implementation of `Entry::insert` as per @SimonSapin's comment on #60142. This requires a patch to hashbrown: ```diff diff --git a/src/rustc_entry.rs b/src/rustc_entry.rs index fefa5c3..7de8300 100644 --- a/src/rustc_entry.rs +++ b/src/rustc_entry.rs @@ -546,6 +546,32 @@ impl<'a, K, V> RustcVacantEntry<'a, K, V> { let bucket = self.table.insert_no_grow(self.hash, (self.key, value)); unsafe { &mut bucket.as_mut().1 } } + + /// Sets the value of the entry with the RustcVacantEntry's key, + /// and returns a RustcOccupiedEntry. + /// + /// # Examples + /// + /// ``` + /// use hashbrown::HashMap; + /// use hashbrown::hash_map::RustcEntry; + /// + /// let mut map: HashMap<&str, u32> = HashMap::new(); + /// + /// if let RustcEntry::Vacant(v) = map.rustc_entry("poneyland") { + /// let o = v.insert_and_return(37); + /// assert_eq!(o.get(), &37); + /// } + /// ``` + #[inline] + pub fn insert_and_return(self, value: V) -> RustcOccupiedEntry<'a, K, V> { + let bucket = self.table.insert_no_grow(self.hash, (self.key, value)); + RustcOccupiedEntry { + key: None, + elem: bucket, + table: self.table + } + } } impl<K, V> IterMut<'_, K, V> { ``` This is also only an implementation for HashMap. I tried implementing for BTreeMap, but I don't really understand BTreeMap's internals and require more guidance on implementing the equivalent `VacantEntry::insert_and_return` such that it returns an `OccupiedEntry`. Notably, following the original PR's modifications I end up needing a `Handle<NodeRef<marker::Mut<'_>, _, _, marker::LeafOrInternal>, _>` while I only have a `Handle<NodeRef<marker::Mut<'_>, _, _, marker::Internal>, _>` and don't know how to proceed. (To be clear, I'm not asking for guidance right now; I'd be happy getting only the HashMap implementation — the subject of this PR — reviewed and ready, and leave the BTreeMap implementation for a latter PR.)
2019-10-08add checking (r == 0)Baoshan Pang-1/+1
2019-10-08Stabilize mem::take (mem_take)Jon Gjengset-1/+0
Tracking issue: https://github.com/rust-lang/rust/issues/61129
2019-10-09Implement (HashMap) Entry::insert as per #60142Félix Saparelli-1/+48
2019-10-08Split non-CAS atomic support off into target_has_atomic_load_storeAmanieu d'Antras-15/+17
2019-10-08Rollup merge of #65187 - Wind-River:master_before_merge, r=rkruppeMazdak Farrokhzad-1/+3
use 'invalid argument' for vxWorks vxWorks is using "invalid argument" instead of "Invalid argument" in reporting invalid options r? @rkruppe
2019-10-07use 'invalid argument' for vxWorksBaoshanPang-1/+3
2019-10-05Rollup merge of #65151 - tmandry:revert-emscripten-upgrade, r=tmandryTyler Mandry-2/+1
Revert #63649 - "Upgrade Emscripten targets to use upstream LLVM backend" This change caused the runtime of the linux-asmjs builder to nearly double from 2+ hours to about 4 hours, which happens to be the bors timeout. (It made it in barely under 4 hours when it was merged.) This is causing timeouts on all new changes. This reverts commit 7870050796e5904a0fc85ecbe6fa6dde1cfe0c91, reversing changes made to 2e7244807a7878f6eca3eb7d97ae9b413aa49014.
2019-10-05Rollup merge of #65126 - BO41:time_typo, r=kennytmTyler Mandry-28/+23
Fix typo on `now()` comments Fix typo, update words, and remove some redundant word. Also rustfmt on the rest of the file (hope this is okay :) revival of #61433 r? @kennytm
2019-10-05Rollup merge of #64765 - alexcrichton:less-check-backtrace, r=sfacklerTyler Mandry-50/+50
std: Reduce checks for `feature = "backtrace"` This is a stylistic change to libstd to reduce the number of checks of `feature = "backtrace"` now that we unconditionally depend on the `backtrace` crate and rely on it having an empty implementation. otherwise.
2019-10-05Rollup merge of #64728 - messense:udp-peer-addr, r=dtolnayTyler Mandry-3/+1
Stabilize UdpSocket::peer_addr Fixes #59127
2019-10-05Revert "Auto merge of #63649 - tlively:emscripten-upstream-upgrade, ↵Tyler Mandry-2/+1
r=alexcrichton" This reverts commit 7870050796e5904a0fc85ecbe6fa6dde1cfe0c91, reversing changes made to 2e7244807a7878f6eca3eb7d97ae9b413aa49014.
2019-10-05Fix typo on `now()` commentsBO41-28/+23
2019-10-04Upgrade Emscripten targets to use upstream LLVM backendThomas Lively-1/+2
- Refactors the Emscripten target spec to share code with other wasm targets. - Replaces the incorrect wasm32 C call ABI with the old asmjs version, which is correct for both wasm32 and JS. - Updates the varargs ABI used by Emscripten and deletes the old one. - Removes the obsolete wasm32-experimental-emscripten target. - Temporarily makes Emscripten targets use panic=abort by default because supporting unwinding will require an LLVM patch.
2019-10-03Rollup merge of #61879 - stjepang:stabilize-todo, r=withoutboatsTyler Mandry-1/+0
Stabilize todo macro The `todo!` macro is just another name for `unimplemented!`. Tracking issue: https://github.com/rust-lang/rust/issues/59277 This PR needs a FCP to merge. r? @withoutboats
2019-10-03Added doc about behavior of extend on HashMapMartin Habovštiak-0/+2
It was unclear what the implementation does when it encounters existing keys. This change makes it clear by documenting the trait impl.
2019-10-02BacktraceStatus: add Eq implBen Boeckel-1/+1
See discussion on #53487.
2019-10-01Rollup merge of #64912 - lzutao:unneeded-main-doc, r=jonas-schievinkMazdak Farrokhzad-166/+119
Remove unneeded `fn main` blocks from docs ## [No whitespace diff](https://github.com/rust-lang/rust/pull/64912/files?w=1)
2019-10-01Remove unneeded `fn main` blocks from docsLzu Tao-166/+119
2019-09-30async/await: improve obligation errorsDavid Wood-0/+1
This commit improves obligation errors for async/await: ``` note: future does not implement `std::marker::Send` because this value is used across an await --> $DIR/issue-64130-non-send-future-diags.rs:15:5 | LL | let g = x.lock().unwrap(); | - has type `std::sync::MutexGuard<'_, u32>` LL | baz().await; | ^^^^^^^^^^^ await occurs here, with `g` maybe used later LL | } | - `g` is later dropped here ``` Signed-off-by: David Wood <david@davidtw.co>
2019-09-28Slice docs: fix typoAndre Bogus-1/+1
2019-09-28Rollup merge of #64836 - lzutao:stabilize-map_get_key_value, r=SimonSapinMazdak Farrokhzad-2/+1
Stabilize map_get_key_value feature FCP done in https://github.com/rust-lang/rust/issues/49347#issuecomment-521728031 r? @SimonSapin Closes #49347
2019-09-28Rollup merge of #64818 - Wind-River:master, r=alexcrichtonMazdak Farrokhzad-2/+2
update rtpSpawn's parameters type(It's prototype has been updated in libc) r? @alexcrichton
2019-09-28Rollup merge of #64703 - llogiq:slices-elems-are-equidistant, r=rkruppeMazdak Farrokhzad-1/+3
Docs: slice elements are equidistant Recently, someone asked why `[char]` and `str` are not interchangeable, and I explained that in a slice, the elements must be laid out equidistantly, whereas the chars in a `str` are stored compactly regardless their size. However I couldn't find this documented anywhere, so here's a small addition of this fact.
2019-09-27Docs: slice elements are equidistantAndre Bogus-1/+3
2019-09-27Stabilize map_get_key_value featureLzu Tao-2/+1
2019-09-25update rtpSpawn's parameters type(It's prototype has been updated in libc)Baoshan Pang-2/+2
2019-09-26Update src/libstd/net/udp.rsmessense-1/+1
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-09-25Fix ExitStatus on FuchsiaTyler Mandry-75/+93
Fuchsia exit codes don't follow the convention of libc::WEXITSTATUS et al, and they are 64 bits instead of 32 bits. This gives Fuchsia its own representation of ExitStatus. Additionally, the zircon syscall structs were out of date, causing us to see bogus return codes.
2019-09-25std: Reduce checks for `feature = "backtrace"`Alex Crichton-50/+50
This is a stylistic change to libstd to reduce the number of checks of `feature = "backtrace"` now that we unconditionally depend on the `backtrace` crate and rely on it having an empty implementation. otherwise.
2019-09-25Snap cfgs to new betaMark Rousskov-1/+0
2019-09-25Rollup merge of #64481 - tomtau:fix/tls-error-message, r=KodrAusMazdak Farrokhzad-2/+2
A more explanatory thread local storage panic message Outside rust-std internals, TLS is usually understood as Transport Layer Security, so the existing message could be a bit puzzling when one has TLS sessions in `thread_local!`.
2019-09-24Rollup merge of #64720 - Wind-River:master, r=alexcrichtonMazdak Farrokhzad-302/+2
remove rtp.rs, and move rtpSpawn and RTP_ID_ERROR to libc r? @alexcrichton
2019-09-24Rollup merge of #64702 - sinkuu:deps, r=jonas-schievinkMazdak Farrokhzad-3/+0
Remove unused dependencies
2019-09-24Rollup merge of #63356 - ali-raheem:issue#63183, r=KodrAusMazdak Farrokhzad-0/+25
Issue#63183: Add fs::read_dir() and ReadDir warning about iterator order + example As per https://github.com/rust-lang/rust/issues/63183 Add warning about iterator order to read_dir and ReadDir, add example of explicitly ordering direntrys.
2019-09-24Stabilize UdpSocket::peer_addrmessense-3/+1