about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2019-10-21Rollup merge of #65639 - adrianheine:patch-2, r=jonas-schievinkMazdak Farrokhzad-1/+1
Fix parameter name in documentation
2019-10-21Rollup merge of #65633 - Rantanen:doc-example-paths, r=CentrilMazdak Farrokhzad-7/+7
Remove leading :: from paths in doc examples Noted some pre-2018 path syntax in the doc examples, for example: https://doc.rust-lang.org/std/process/fn.exit.html ```rust fn main() { ::std::process::exit(match run_app() { Ok(_) => 0, ... ``` Couldn't find an existing issue on this (then again, "::" makes for an annoying thing to search for) so if there is already something fixing this and/or there's a reason to not fix it, just close this PR. (Also fixed indentation in the `process::exit()` docs)
2019-10-20Fix parameter name in documentationAdrian Heine né Lang-1/+1
2019-10-20Remove leading :: from paths in doc examplesMikko Rantanen-7/+7
2019-10-20Rollup merge of #65551 - sinkuu:cstring_spec, r=sfacklerMazdak Farrokhzad-1/+26
Avoid realloc in `CString::new` If `&[u8]` or `&str` is given, `CString::new` allocates a new `Vec` with the exact capacity, and then `CString::from_vec_unchecked` calls `.reserve_exact(1)` for nul byte. This PR avoids the reallocation by allocationg `len + 1` bytes beforehand. In microbenchmark this PR speeds up `CString::new(&[u8])` by 30%.
2019-10-20Merge branch 'master' into rusty-hermitStefan Lankes-158/+418
2019-10-20move interface to the unikernel in the crate hermit-abiStefan Lankes-113/+57
=> simplifies the maintenance of the interface
2019-10-20fix WASI sleep implArtyom Pavlov-4/+4
2019-10-20Auto merge of #65469 - mati865:libc, r=alexcrichtonbors-34/+2
Update libc to 0.2.64 Passed local tests. cc potentially interested people: @gnzlbg @tlively
2019-10-18reworded loop value sentenceYves Dorfsman-2/+3
2019-10-18remove stray changeStefan Lankes-1/+2
2019-10-18Added doc on keyword breakYves Dorfsman-2/+64
2019-10-18Avoid realloc in `CString::new`Shotaro Yamada-1/+26
2019-10-18Fix cast of stx_btime.tv_nsecoxalica-1/+1
2019-10-18Fix cfgs for current libcoxalica-89/+139
2019-10-18Prefer statx on linux if availableoxalica-11/+182
2019-10-17Rollup merge of #65486 - mathstuf:osstr-doc-typo, r=TimNNMazdak Farrokhzad-4/+4
doc: fix typo in OsStrExt and OsStringExt
2019-10-17Rollup merge of #65461 - Kampfkarren:patch-1, r=CentrilMazdak Farrokhzad-3/+2
Don't recommend ONCE_INIT in std::sync::Once ONCE_INIT is deprecated, and so suggesting it as not only being on par with, but before `Once::new` is a bad idea.
2019-10-17Rollup merge of #65316 - oconnor663:noninheritable, r=alexcrichtonMazdak Farrokhzad-1/+1
make File::try_clone produce non-inheritable handles on Windows ~**NOT READY FOR REVIEW.** This PR is currently mainly to trigger CI so that I can see what happens. (Is there a better way to trigger CI?) I don't know whether this change makes sense yet.~ (Edit: @Mark-Simulacrum clarified that CI doesn't currently run on Windows.) --- File handles shouldn't be inheritable in general. `std::process::Command` takes care of making them inheritable when child processes are spawned, and the `CREATE_PROCESS_LOCK` protects against races in that section on Windows. But `File::try_clone` has been creating inheritable file descriptors outside of that lock, which could be leaking into other child processes unintentionally. See also https://github.com/rust-lang/rust/pull/31069#discussion_r334117665.
2019-10-17Update emscripten functions declarationsMateusz Mikuła-34/+2
2019-10-16doc: fix typo in OsStrExt and OsStringExtBen Boeckel-4/+4
2019-10-16Upgrade Emscripten targets to use upstream LLVM backendThomas Lively-1/+2
- Compatible with Emscripten 1.38.46-upstream or later upstream. - Refactors the Emscripten target spec to share code with other wasm targets. - Replaces the old incorrect wasm32 C call ABI with the correct one, preserving the old one as wasm32_bindgen_compat for wasm-bindgen compatibility. - Updates the varargs ABI used by Emscripten and deletes the old one. - Removes the obsolete wasm32-experimental-emscripten target. - Uses EMCC_CFLAGS on CI to avoid the timeout problems with #63649.
2019-10-16Fix read/write links hopefully!Tim Hutt-2/+4
2019-10-16Don't recommend ONCE_INIT in std::sync::Onceboyned//Kampfkarren-3/+2
ONCE_INIT is deprecated, and so suggesting it as not only being on par with, but before `Once::new` is a bad idea.
2019-10-15Add File::with_optionsTim Hutt-2/+33
This provides a more fluent API to create files with options, and also avoids the need to import OpenOptions.
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-11make File::try_clone produce non-inheritable handles on WindowsJack O'Connor-1/+1
File handles shouldn't be inheritable in general. `std::process::Command` takes care of making them inheritable when child processes are spawned, and the `CREATE_PROCESS_LOCK` protects against races in that section on Windows. But `File::try_clone` has been creating inheritable file descriptors outside of that lock, which could be leaking into other child processes unintentionally. See also https://github.com/rust-lang/rust/pull/31069#discussion_r334117665.
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-11Prefer `ManuallyDrop::{take,new}` over `ptr::{read,write}`Oliver Scherer-3/+4
2019-10-11Remove uses of `allow(unions_with_drop_fields)` in the standard librarySimon Sapin-8/+7
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-06minor changes to follow the Rust's style guidelinesStefan Lankes-5/+10