about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2018-07-16Document From conversions for OsString and OsStrMarkus Wein-0/+21
2018-07-14Rollup merge of #52156 - zajlerke:update-deprecation-notice, r=Kimundikennytm-10/+30
Update std::ascii::ASCIIExt deprecation notes Fixes #52085
2018-07-13Fix redox libstd leftoverTatsuyuki Ishi-2/+2
2018-07-13Auto merge of #52281 - cramertj:fast-tls, r=alexcrichtonbors-6/+1
Use fast TLS on Fuchsia I'm not sure why Fuchsia was separated here, but we provide these symbols, and tests are passing in QEMU with this change. cc @raphlinus. r? @alexcrichton
2018-07-12Rollup merge of #52298 - RalfJung:dirs, r=Mark-Simulacrumkennytm-1/+1
make reference to dirs crate clickable in terminals Currently I have to copy-paste the link; with this change I can just click it right in my terminal window.
2018-07-12Rollup merge of #52277 - kraai:patch-2, r=kennytmkennytm-1/+1
Uncapitalize "If"
2018-07-12Rollup merge of #51912 - mbrubeck:more_box_slice_clone, r=alexcrichtonkennytm-0/+24
impl Clone for Box<CStr>, Box<OsStr>, Box<Path> Implements #51908.
2018-07-12make reference to dirs crate clickable in terminalsRalf Jung-1/+1
2018-07-11Use fast TLS on FuchsiaTaylor Cramer-6/+1
2018-07-11Uncapitalize "If"Matt Kraai-1/+1
2018-07-11simplify assertionsAndy Russell-5/+4
2018-07-11Rollup merge of #52239 - CAD97:patch-1, r=alexcrichtonMark Rousskov-6/+6
Remove sync::Once::call_once 'static bound See https://internals.rust-lang.org/t/sync-once-per-instance/7918 for more context. Suggested r is @alexcrichton, the one who added the `'static` bound back in 2014. I don't want to officially r? though, if the system would even let me. I'd rather let the system choose the appropriate member since it knows more than I do. `git blame` history for `sync::Once::call_once`'s signature: - [std: Second pass stabilization of sync](https://github.com/rust-lang/rust/commit/f3a7ec7028c76b3a1c6051131328f372b068e33a) (Dec 2014) ```diff - pub fn doit<F>(&'static self, f: F) where F: FnOnce() { + #[stable] + pub fn call_once<F>(&'static self, f: F) where F: FnOnce() { ``` - [libstd: use unboxed closures](https://github.com/rust-lang/rust/commit/cdbb3ca9b776b066e2c93acfb60da8537d2b1c9b) (Dec 2014) ```diff - pub fn doit(&'static self, f: ||) { + pub fn doit<F>(&'static self, f: F) where F: FnOnce() { ``` - [std: Rewrite the `sync` module](https://github.com/rust-lang/rust/commit/71d4e77db8ad4b6d821da7e5d5300134ac95974e) (Nov 2014) ```diff - pub fn doit(&self, f: ||) { + pub fn doit(&'static self, f: ||) { ``` > ```text > The second layer is the layer provided by `std::sync` which is intended to be > the thinnest possible layer on top of `sys_common` which is entirely safe to > use. There are a few concerns which need to be addressed when making these > system primitives safe: > > * Once used, the OS primitives can never be **moved**. This means that they > essentially need to have a stable address. The static primitives use > `&'static self` to enforce this, and the non-static primitives all use a > `Box` to provide this guarantee. > ``` The author of this diff is @alexcrichton. `sync::Once` now contains only a pointer to (privately hidden) `Waiter`s, which are all stack-allocated. The `'static` bound to `sync::Once` is thus unnecessary to guarantee that any OS primitives are non-relocatable. As the `'static` bound is not required for `sync::Once`'s operation, removing it is strictly more useful. As an example, it allows attaching a one-time operation to instances rather than only to global singletons.
2018-07-11Auto merge of #51553 - jD91mZM2:uds, r=sfacklerbors-1/+740
Unix sockets on redox This is done using the ipcd daemon. It's not exactly like unix sockets because there is not actually a physical file for the path, but it's close enough for a basic implementation :) This allows mio-uds and tokio-uds to work with a few modifications as well, which is exciting!
2018-07-11Add missing dyn in testsljedrz-9/+9
2018-07-10remove sync::Once::call_once 'staticChristopher Durham-6/+6
- [std: Rewrite the `sync` modulehttps://github.com/rust-lang/rust/commit/71d4e77db8ad4b6d821da7e5d5300134ac95974e) (Nov 2014) ```diff - pub fn doit(&self, f: ||) { + pub fn doit(&'static self, f: ||) { ``` > ```text > The second layer is the layer provided by `std::sync` which is intended to be > the thinnest possible layer on top of `sys_common` which is entirely safe to > use. There are a few concerns which need to be addressed when making these > system primitives safe: > > * Once used, the OS primitives can never be **moved**. This means that they > essentially need to have a stable address. The static primitives use > `&'static self` to enforce this, and the non-static primitives all use a > `Box` to provide this guarantee. > ``` The author of this diff is @alexcrichton. `sync::Once` contains only a pointer to (privately hidden) `Waiter`s, which are all stack-allocated. The `'static` bound to `sync::Once` is thus unnecessary to guarantee that any OS primitives are non-relocatable. See https://internals.rust-lang.org/t/sync-once-per-instance/7918 for more context.
2018-07-10Add missing `dyn` for cloudabi, redox, unix and wasmljedrz-7/+7
2018-07-10Deny bare trait objects in `src/libstd`.ljedrz-98/+99
2018-07-09Implement #[alloc_error_handler]Simon Sapin-2/+4
This to-be-stable attribute is equivalent to `#[lang = "oom"]`. It is required when using the alloc crate without the std crate. It is called by `handle_alloc_error`, which is in turned called by "infallible" allocations APIs such as `Vec::push`.
2018-07-09Remove `extern` on the `pub fn rust_oom` lang item in libstd, to match ABI ↵Simon Sapin-1/+1
of the declaration in liballoc This turned out to be important on Windows. Calling `handle_alloc_error(Layout::new::<[u8; 42]>())` caused: ``` Exception thrown at 0x00007FF7C70DC399 in a.exe: 0xC0000005: Access violation reading location 0x000000000000002A. ``` 0x2A equals 42, so it looks like the `Layout::size` field of type `usize` was interpreted as a pointer to read from.
2018-07-09Auto merge of #52159 - SimonSapin:alloc-prelude, r=alexcrichtonbors-16/+42
Add the `alloc::prelude` module It contains the re-exports that are in `std::prelude::v1` but not in `core::prelude::v1`. Calling it prelude is somewhat of a misnomer since (unlike those modules in `std` or `core`) its contents are never implicitly imported in modules. Rather it is intended to be used with an explicit glob import like `use alloc::prelude::*;`. However there is precedent for the same misnomer with `std::io::prelude`, for example. This new module is unstable with the same feature name as the `alloc` care. They are proposed for stabilization together in RFC https://github.com/rust-lang/rfcs/pull/2480.
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