about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2020-02-20Rollup merge of #68945 - mjbshaw:once_is_completed, r=LukasKalbertodtDylan DPC-6/+5
Stabilize Once::is_completed Closes #54890 This function has been around for some time. I haven't seen anyone raise any objections to it. I've personally found it useful myself. It would be nice to finally stabilize it and
2020-02-19Reword OpenOptions::{create, create_new} doc.jumbatm-8/+4
2020-02-18Rollup merge of #68767 - kubo39:patch-macos, r=shepmasterYuki Okushi-2/+3
macOS: avoid calling pthread_self() twice
2020-02-16macOS: avoid calling pthread_self() twiceHiroki Noda-2/+3
2020-02-15Rollup merge of #69106 - RReverser:wasi-fs-copy, r=KodrAusDylan DPC-1/+9
Fix std::fs::copy on WASI target Previously `std::fs::copy` on wasm32-wasi would reuse code from the `sys_common` module and would successfully copy contents of the file just to fail right before closing it. This was happening because `sys_common::copy` tries to copy permissions of the file, but permissions are not a thing in WASI (at least yet) and `set_permissions` is implemented as an unconditional runtime error. This change instead adds a custom working implementation of `std::fs::copy` (like Rust already has on some other targets) that doesn't try to call `set_permissions` and is essentially a thin wrapper around `std::io::copy`. Fixes #68560.
2020-02-15Rollup merge of #64069 - ↵Dylan DPC-0/+28
danielhenrymantilla:feature/cstring_from_vec_of_nonzerou8, r=KodrAus Added From<Vec<NonZeroU8>> for CString Added a `From<Vec<NonZeroU8>>` `impl` for `CString` # Rationale - `CString::from_vec_unchecked` is a subtle function, that makes `unsafe` code harder to audit when the generated `Vec`'s creation is non-trivial. This `impl` allows to write safer `unsafe` code thanks to the very explicit semantics of the `Vec<NonZeroU8>` type. - One such situation is when trying to `.read()` a `CString`, see issue #59229. - this lead to a PR: #59314, that was closed for being too specific / narrow (it only targetted being able to `.read()` a `CString`, when this pattern could have been generalized). - the issue suggested another route, based on `From<Vec<NonZeroU8>>`, which is indeed a less general and more concise code pattern. - quoting @shnatsel: - > For me the main thing about making this safe is simplifying auditing - people have spent like an hour looking at just this one unsafe block in libflate because it's not clear what exactly is unchecked, so you have to look it up when auditing anyway. This has distracted us from much more serious memory safety issues the library had. Having this trivial impl in stdlib would turn this into safe code with compiler more or less guaranteeing that it's fine, and save anyone auditing the code a whole lot of time.
2020-02-14Fix tests after rebaseMatthew Jasper-1/+2
2020-02-13Add comment to SGX entry codeJethro Beekman-0/+1
2020-02-13Rollup merge of #69068 - Goirad:make-sgx-arg-cleanup-nop, r=jethrogb,nagisaDylan DPC-6/+1
Make the SGX arg cleanup implementation a NOP fixes #64304 cc @jethrogb
2020-02-13Rollup merge of #67642 - Mark-Simulacrum:relax-bounds, r=AmanieuDylan DPC-75/+71
Relax bounds on HashMap/HashSet These APIs changed from the old bound listed to the new bound (possibly empty): K: Hash + Eq -> K * new * with_capacity K: Eq + Hash, S: BuildHasher -> K, S * with_hasher * with_capacity_and_hasher * hasher K: Eq + Hash + Debug -> K: Debug S: BuildHasher -> S HashMap as Debug K: Eq + Hash -> K S: BuildHasher + Default -> S: Default HashMap as Default Resolves #44777.
2020-02-12Fix std::fs::copy on WASI targetIngvar Stepanyan-1/+9
Previously `std::fs::copy` on wasm32-wasi would reuse code from the `sys_common` module and would successfully copy contents of the file just to fail right before closing it. This was happening because `sys_common::copy` tries to copy permissions of the file, but permissions are not a thing in WASI (at least yet) and `set_permissions` is implemented as an unconditional runtime error. This change instead adds a custom working implementation of `std::fs::copy` (like Rust already has on some other targets) that doesn't try to call `set_permissions` and is essentially a thin wrapper around `std::io::copy`. Fixes #68560.
2020-02-12Rollup merge of #69040 - jethrogb:jb/cleanup-sgx-entry, r=nagisaDylan DPC-10/+29
Cleanup SGX entry code cc @aandyl
2020-02-12Rollup merge of #69038 - yaahc:backtrace-debug, r=dtolnayDylan DPC-6/+63
Add initial debug fmt for Backtrace Fixes the first point in https://github.com/rust-lang/rust/issues/65280 related to https://github.com/rust-lang/rust/issues/53487
2020-02-12Rollup merge of #69042 - yaahc:backtrace-header, r=dtolnayDylan DPC-1/+2
Remove backtrace header text Fixes point 3 from https://github.com/rust-lang/rust/issues/65280 related to https://github.com/rust-lang/rust/issues/53487 This should probably be double checked by someone who works on fuschia because theres some extra fuschia specific output in `add_context` that is also removed by this change.
2020-02-12Rollup merge of #67695 - gilescope:truth, r=centrilYuki Okushi-5/+44
Added dyn and true keyword docs r? @Centril
2020-02-11Fix failing backtrace ui testsJane Lusby-0/+1
2020-02-11Keyword docsGiles Cope-5/+44
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com> Co-Authored-By: Tim Robinson <tim.g.robinson@gmail.com> Co-Authored-By: Peter Todd <pete@petertodd.org> Co-Authored-By: Dylan DPC <dylan.dpc@gmail.com>
2020-02-11make the sgx arg cleanup implementation a no opDario Gonzalez-6/+1
2020-02-11remove intentionally failing testJane Lusby-18/+0
2020-02-10backwards again, god damnitJane Lusby-1/+1
2020-02-10rule over the code in libstd with an iron fistJane Lusby-9/+4
2020-02-10maximum alternative consistency!Jane Lusby-2/+9
2020-02-10make symbol printing consistent with backtrace_rsJane Lusby-2/+3
2020-02-10add nice alt fmt for debugJane Lusby-6/+6
2020-02-10use debug_map and skip empty framesJane Lusby-5/+10
2020-02-10remove Some from fn nameJane Lusby-1/+1
2020-02-10final format cleanupsJane Lusby-1/+8
2020-02-10make it compileJane Lusby-1/+1
2020-02-10remove unnecessary Debug impl for BacktraceFrameJane Lusby-6/+0
2020-02-10remove unnecessary derivesJane Lusby-2/+0
2020-02-10less noisy formatJane Lusby-7/+37
2020-02-10Get vaguely working with a test for checking outputJane Lusby-1/+26
2020-02-10Add initial debug fmt for BacktraceJane Lusby-6/+19
2020-02-10Bump version to backtrace without the headerJane Lusby-1/+1
2020-02-10Avoid jumping to Rust code with user %rsp (reentry_panic)Jethro Beekman-7/+6
2020-02-10sanitize MXCSR/FPU control registersRaoul Strackx-0/+11
2020-02-10Corrected ac_mitigation patch. That patch used the untrusted stack to clear ↵Raoul Strackx-7/+16
rflags during enclave (re-)entry
2020-02-10Fix SGX RWLock representation for UnsafeCell niche fixJethro Beekman-11/+13
2020-02-07Stabilize Once::is_completedMichael Bradshaw-6/+5
2020-02-06Rollup merge of #68524 - jonas-schievink:generator-resume-arguments, r=ZoxcDylan DPC-1/+4
Generator Resume Arguments cc https://github.com/rust-lang/rust/issues/43122 and https://github.com/rust-lang/rust/issues/56974 Blockers: * [x] Fix miscompilation when resume argument is live across a yield point (https://github.com/rust-lang/rust/pull/68524#issuecomment-578459069) * [x] Fix 10% compile time regression in `await-call-tree` benchmarks (https://github.com/rust-lang/rust/pull/68524#issuecomment-578487162) * [x] Fix remaining 1-3% regression (https://github.com/rust-lang/rust/pull/68524#issuecomment-579566255) - resolved (https://github.com/rust-lang/rust/pull/68524#issuecomment-581144901) * [x] Make dropck rules account for resume arguments (https://github.com/rust-lang/rust/pull/68524#issuecomment-578541137) Follow-up work: * Change async/await desugaring to make use of this feature * Rewrite [`box_region.rs`](https://github.com/rust-lang/rust/blob/3d8778d767f0dde6fe2bc9459f21ead8e124d8cb/src/librustc_data_structures/box_region.rs) to use resume arguments (this shows up in profiles too)
2020-02-06Auto merge of #68861 - Dylan-DPC:rollup-0m09hsg, r=Dylan-DPCbors-3/+2
Rollup of 8 pull requests Successful merges: - #68762 (Strip unnecessary subexpression) - #68790 (Improve `merge_from_succ`) - #68809 (Make more arithmetic functions unstably const) - #68832 (Clean up E0264, E0267 and E0268 explanations) - #68840 (On suggesting `#![recursion_limit = "X"]`, note current crate name) - #68846 (doc fix on doc attribute) - #68851 (Fix issue number of `capacity` method) - #68858 (Merge item id stable hashing functions) Failed merges: r? @ghost
2020-02-05Rollup merge of #68851 - JohnTitor:fix-issue-number, r=CentrilDylan DPC-2/+2
Fix issue number of `capacity` method Follow-up of https://github.com/rust-lang/rust/pull/68558#issuecomment-582117131 r? @alexcrichton
2020-02-05Rollup merge of #68762 - ForNeVeR:patch-1, r=alexcrichtonDylan DPC-1/+0
Strip unnecessary subexpression It became unnecessary since a06baa56b95674fc626b3c3fd680d6a65357fe60 reformatted the file. The comment is currently a bit misleading.
2020-02-05Auto merge of #68755 - Tyg13:update_stdarch, r=alexcrichtonbors-6/+1
Update `rust-lang/stdarch` submodule Update submodule [rust-lang/stdarch](https://github.com/rust-lang/stdarch/)
2020-02-05Fix issue number of `capacity` methodYuki Okushi-2/+2
2020-02-04Auto merge of #68558 - HeroicKatora:buf-writer-capacity, r=alexcrichtonbors-0/+45
Add a method to query the capacity of a BufWriter and BufReader Besides the obvious of retrieving the parameter used to construct the writer, this method allows consumers to control the number of `flush` calls during write operations. For `BufReader` it gives an upper bound on the returned buffer in `fill_buf` which might influence the allocation behaviour of a consumer.
2020-02-04Added From<Vec<NonZeroU8>> for CStringDaniel Henry-Mantilla-0/+28
Updated tracking issue number Added safeguards for transmute_vec potentially being factored out elsewhere Clarified comment about avoiding mem::forget Removed unneeded unstable guard Added back a stability annotation for CI Minor documentation improvements Thanks to @Centril's code review Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com> Improved layout checks, type annotations and removed unaccurate comment Removed unnecessary check on array layout Adapt the stability annotation to the new 1.41 milestone Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com> Simplify the implementation. Use `Vec::into_raw_parts` instead of a manual implementation of `Vec::transmute`. If `Vec::into_raw_parts` uses `NonNull` instead, then the code here will need to be adjusted to take it into account (issue #65816) Reduce the whitespace of safety comments
2020-02-04Auto merge of #68708 - Mark-Simulacrum:stage0-step, r=pietroalbinibors-23/+1
Step stage0 to bootstrap from 1.42 This also includes a commit which fixes the rustfmt downloading logic to redownload when the rustfmt channel changes, and bumps rustfmt to a more recent version.
2020-02-03Rollup merge of #68797 - GuillaumeGomez:link-to-types, r=Dylan-DPCDylan DPC-2/+2
Fix links to types instead of modules r? @Dylan-DPC
2020-02-03Fix links to types instead of modulesGuillaume Gomez-2/+2