about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2018-07-08rework `LineWriter` exampleAndy Russell-10/+24
The original example didn't check the return value of `write()`, didn't flush the writer, and didn't properly demonstrate the buffering. Fixes #51621.
2018-07-08Delete leftover filesjD91mZM2-1337/+0
2018-07-08Update std::ascii::ASCIIExt deprecation notesKevin Zajler-10/+30
2018-07-08Edit code example for File::openFabian Drinck-3/+3
2018-07-07Reformat std prelude source to show it is the sum of core and alloc preludesSimon Sapin-16/+42
2018-07-07Add is_unnamedjD91mZM2-0/+27
2018-07-07Revert unification of interfacesjD91mZM2-32/+1539
2018-07-07Auto merge of #51656 - soc:topic/fix-home-dir, r=SimonSapinbors-10/+15
Deprecate `std::env::home_dir` and fix incorrect documentation Compare `std::env::home_dir`s claim: > Returns the value of the 'HOME' environment variable if it is set and not equal to the empty string. ... with its actual behavior: ``` std::env::set_var("HOME", ""); println!("{:?}", std::env::var_os("HOME")); // Some("") println!("{:?}", std::env::home_dir()); // Some("") ``` The implementation is incorrect in two cases: - `$HOME` is set, but empty. - An entry for the user exists in `/etc/passwd`, but it's `pw_dir` is empty. In both cases Rust considers an empty string to be a valid home directory. This contradicts the documentation, and is wrong in general.
2018-07-07Deprecate `std::env::home_dir` and fix incorrect documentationSimon Ochsenreither-10/+15
2018-07-06Auto merge of #51757 - nielx:fix/haiku-fixes, r=nagisabors-1/+2
Haiku: several smaller fixes to build and run rust on Haiku This PR combines three small patches that help Rust build and run on the Haiku platform. These patches do not intend to impact other platforms.
2018-07-06impl Clone for Box<CStr>, Box<OsStr>, Box<Path>Matt Brubeck-0/+24
Implements #51908.
2018-07-03Rollup merge of #51973 - estk:master, r=abonanderPietro Albini-0/+26
Make Stdio handle UnwindSafe Closes #51863 This is my first compiler PR. Thanks Niko for the mentor help! r? @nikomatsakis
2018-07-03Rollup merge of #51809 - drrlvn:rw_exact_all_at, r=alexcrichtonPietro Albini-0/+127
Add read_exact_at and write_all_at methods to FileExt on unix This PR adds `FileExt::read_exact_at()` and `FileExt::write_all_at()`, which are to `read_at()` and `write_at()` as `read_exact()` and `write_all()` are to `read()` and `write()`. This allows the user to not have to deal with `ErrorKind::Interrupted` and calling the functions in a loop. I was unsure as to how to mark these new methods so I marked them `unstable`, please let me know if I should have done it differently. I asked in Discord and was told that as this change is small it does not require an RFC.
2018-07-03Remove stability attributes on private types and leftover docsjD91mZM2-18/+0
2018-07-03Auto merge of #51564 - SimonSapin:try-int, r=alexcrichtonbors-18/+2
Implement always-fallible TryFrom for usize/isize conversions that are infallible on some platforms This reverts commit 837d6c70233715a0ae8e15c703d40e3046a2f36a "Remove TryFrom impls that might become conditionally-infallible with a portability lint". This fixes #49415 by adding (restoring) missing `TryFrom` impls for integer conversions to or from `usize` or `isize`, by making them always fallible at the type system level (that is, with `Error=TryFromIntError`) even though they happen to be infallible on some platforms (for some values of `size_of::<usize>()`). They had been removed to allow the possibility to conditionally having some of them be infallible `From` impls instead, depending on the platforms, and have the [portability lint](https://github.com/rust-lang/rfcs/pull/1868) warn when they are used in code that is not already opting into non-portability. For example `#[allow(some_lint)] usize::from(x: u64)` would be valid on code that only targets 64-bit platforms. This PR gives up on this possiblity for two reasons: * Based on discussion with @aturon, it seems that the portability lint is not happening any time soon. It’s better to have the conversions be available *at all* than keep blocking them for so long. Portability-lint-gated platform-specific APIs can always be added separately later. * For code that is fine with fallibility, the alternative would force it to opt into "non-portability" even though there would be no real portability issue.
2018-07-02Make Stdio handle UnwindSafeEvan Simmons-0/+26
2018-07-02Fill in tracking issue number for read_exact_at/write_all_atDror Levin-2/+2
2018-07-02Auto merge of #51931 - cramertj:rm-libbacktrace, r=alexcrichtonbors-5/+0
Use in-tree libbacktrace on Fuchsia cc @abarth r? @alexcrichton (welcome back! :smile: )
2018-07-01Rollup merge of #51890 - Ixrec:patch-3, r=alexcrichtonPietro Albini-1/+1
Fix inconsequential typo in GlobalAlloc doc example
2018-07-01Rollup merge of #51853 - MajorBreakfast:fix-doc-links, r=cramertjPietro Albini-0/+1
Fix some doc links The futures crate CI always fails because of these intra doc links. I hope that this will fix this issue. r? @steveklabnik @cramertj Edit: I added @steveklabnik as reviewer because this PR also adjusts a link in `src/libstd/error.rs`
2018-06-30Auto merge of #51717 - Mark-Simulacrum:snap, r=alexcrichtonbors-72/+33
Bootstrap from 1.28.0 beta
2018-06-30Bootstrap from 1.28.0-beta.3Mark Simulacrum-72/+33
2018-06-30Auto merge of #51178 - GabrielMajeri:os-str-compare, r=SimonSapinbors-0/+14
Implement PartialEq between &str and OsString This fixes #49854. It allows equality comparison between `OsString` values and `str` references, such as `os_string == "something"`.
2018-06-29Use in-tree libbacktrace on FuchsiaTaylor Cramer-5/+0
2018-06-29Rename alloc::arc to alloc::sync, to match std::syncSimon Sapin-1/+1
2018-06-29Move core::alloc::CollectionAllocErr to alloc::collectionsSimon Sapin-3/+4
2018-06-29Move some alloc crate top-level items to a new alloc::collections moduleSimon Sapin-4/+4
This matches std::collections
2018-06-29Fix stability attributesGabriel Majeri-2/+2
2018-06-29Implement PartialEq between &str and OsStringGabriel Majeri-0/+14
Allows for example `os_string == "something"`
2018-06-29Auto merge of #50526 - moxian:just-fix, r=alexcrichtonbors-101/+398
Add a fallback for stacktrace printing for older Windows versions. Some time ago we switched stack inspection functions of dbghelp.dll to their newer alternatives that also capture inlined context. Unfortunately, said new alternatives are not present in older dbghelp.dll versions. In particular Windows 7 at the time of writing has dbghelp.dll version 6.1.7601 from 2010, that lacks StackWalkEx and friends. Tested on my Windows 7 - both msvc and gnu versions produce a readable stacktrace. Fixes #50138
2018-06-29Auto merge of #51290 - Pslydhh:master, r=alexcrichtonbors-2/+8
park/park_timeout: prohibit spurious wakeups in next park <pre><code> // The implementation currently uses the trivial strategy of a Mutex+Condvar // with wakeup flag, which does not actually allow spurious wakeups. </pre></code> Because does not actually allow spurious wakeups. so we have let thread.inner.cvar.wait(m) in the loop to prohibit spurious wakeups. but if notified after we locked, this notification doesn't be consumed, it return, the next park will consume this notification...this is also 'spurious wakeup' case, 'one unpark() wakeups two park()'. We should improve this situation: `thread.inner.state.store(EMPTY, SeqCst);`
2018-06-29Fix inconsequential typo in GlobalAlloc doc exampleIxrec-1/+1
2018-06-28Change traits to bare FnMut where possible.moxian-111/+67
2018-06-28Make msvc symbol extraction/printing functions generic.moxian-103/+137
2018-06-28Make stackwalking generic instead of matching on enum variants.moxian-133/+147
2018-06-28Load backtrace-related functions only oncemoxian-41/+77
.. and pass them around in BacktraceContext.
2018-06-28Split separate stackwalk variants into their own functionsmoxian-204/+238
.. rather than having them be one giant match statement.
2018-06-28Add a fallback for stacktrace printing for older Windows versions.moxian-108/+331
PR #47252 switched stack inspection functions of dbghelp.dll to their newer alternatives that also capture inlined context. Unfortunately, said new alternatives are not present in older dbghelp.dll versions. In particular Windows 7 at the time of writing has dbghelp.dll version 6.1.7601 from 2010, that lacks StackWalkEx and friends. Fixes #50138
2018-06-28Rollup merge of #51824 - vorner:thread-local-try-with-doc, r=kennytmkennytm-1/+1
Fix the error reference for LocalKey::try_with There's no such thing as `ThreadLocalError` and the method obviously returns `AccessError`, so adjusting (probably only outdated docs).
2018-06-28Rollup merge of #50342 - fkjogu:euclidean, r=BurntSushikennytm-2/+20
Document round-off error in `.mod_euc()`-method, see issue #50179 Due to a round-off error the method `.mod_euc()` of both `f32` and `f64` can produce mathematical invalid outputs. If `self` in magnitude is much small than the modulus `rhs` and negative, `self + rhs` in the first branch cannot be represented in the given precision and results into `rhs`. In the mathematical strict sense, this breaks the definition. But given the limitation of floating point arithmetic it can be thought of the closest representable value to the true result, although it is not strictly in the domain `[0.0, rhs)` of the function. It is rather the left side asymptotical limit. It would be desirable that it produces the mathematical more sound approximation of `0.0`, the right side asymptotical limit. But this breaks the property, that `self == self.div_euc(rhs) * rhs + a.mod_euc(rhs)`. The discussion in issue #50179 did not find an satisfying conclusion to which property is deemed more important. But at least we can document the behaviour. Which this pull request does.
2018-06-27Fix doc linksJosef Reinhard Brandl-0/+1
2018-06-27Add is_unnamed on redoxjD91mZM2-24/+58
2018-06-27[fuchsia] Update zx_cprng_draw to target semanticsAdam Barth-26/+2
This change is the final step in improving the semantics of zx_cprng_draw. Now the syscall always generates the requested number of bytes. If the syscall would have failed to generate the requested number of bytes, the syscall either terminates the entire operating system or terminates the calling process, depending on whether the error is a result of the kernel misbehaving or the userspace program misbehaving.
2018-06-27Fix tidy checksjD91mZM2-7/+22
2018-06-27Horrible attempt at cleaning things up that probably just made it worsejD91mZM2-1549/+1348
2018-06-27Fix the error reference for LocalKey::try_withMichal 'vorner' Vaner-1/+1
2018-06-26Revert "Remove functions that always error"jD91mZM2-0/+181
This reverts commit 21d09b983de87fec2e98832f4c30b52f12d6342f.
2018-06-26Mention redox' behavior in doc commentsjD91mZM2-0/+12
2018-06-26Remove functions that always errorjD91mZM2-181/+0
2018-06-26Disallow constructing SocketAddr from third-party codejD91mZM2-2/+2