about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2019-06-12Hygienize macros in the standard libraryVadim Petrochenkov-8/+8
2019-06-11Rollup merge of #61652 - JohnTitor:docs-improve-array, r=CentrilMazdak Farrokhzad-2/+12
Mention slice patterns in array Fixes #61650 r? @scottmcm
2019-06-10std: Remove internal definitions of `cfg_if!` macroAlex Crichton-43/+14
This is duplicated in a few locations throughout the sysroot to work around issues with not exporting a macro in libstd but still wanting it available to sysroot crates to define blocks. Nowadays though we can simply depend on the `cfg-if` crate on crates.io, allowing us to use it from there!
2019-06-10Add an exampleYuki Okushi-0/+10
2019-06-08Mention slice patternsYuki Okushi-2/+2
2019-06-08Rollup merge of #61647 - JohnTitor:use-stable-func, r=CentrilMazdak Farrokhzad-2/+2
Use stable wrappers in f32/f64::signum Fixes #61638 r? @Centril
2019-06-08Rollup merge of #61223 - czipperz:tuple-ord-document-ordering, r=oli-obkMazdak Farrokhzad-0/+4
Document tuple's Ord behavior as sequential Partially closing #50727
2019-06-08Use stable wrappersYuki Okushi-2/+2
2019-06-07Rollup merge of #61603 - Goirad:increase-sgx-heapsize, r=alexcrichtonMazdak Farrokhzad-0/+2
Increases heap size available during testing for SGX PR [61540](https://github.com/rust-lang/rust/pull/61540) causes at least one test to fail when run for the SGX platform due to lack of memory. This PR increases the heapsize available during tests, which is a good thing regardless of the status of that PR.
2019-06-06increase max heapsize available during sgx testsDario Gonzalez-0/+2
2019-06-06Update compiler_builtinsvarkor-1/+1
2019-06-06Auto merge of #57428 - alexreg:associated_type_bounds, r=nikomatsakis,Centrilbors-3/+4
Implementation of RFC 2289 (associated_type_bounds) This PR implements the [`asociated_type_bounds` feature](https://github.com/rust-lang/rfcs/blob/master/text/2289-associated-type-bounds.md). Associated type bounds are implemented in: - function/method arguments and return types - structs, enums, unions - associated items in traits - type aliases - type parameter defaults - trait objects - let bindings CC @nikomatsakis @centril
2019-06-05Aggregation of drive-by cosmetic changes.Alexander Regueiro-3/+4
2019-06-05Rollup merge of #61534 - ReinierMaas:patch-1, r=CentrilMazdak Farrokhzad-1/+4
Edit docs of ExitStatus The documentation of [`ExitStatus`] are extended to be at the same depth as [`Output`].
2019-06-05Rollup merge of #61503 - jethrogb:jb/fix-sgx-test, r=alexcrichtonMazdak Farrokhzad-1/+2
Fix cfg(test) build for x86_64-fortanix-unknown-sgx
2019-06-05Auto merge of #61502 - alexcrichton:update-backtrace, r=estebankbors-1/+1
std: Update dependency on `backtrace` Discovered in #61416 an accidental regression in libstd's backtrace behavior is that it previously attempted to consult libbacktrace and would then fall back to `dladdr` if libbacktrace didn't report anything. The `backtrace` crate, however, did not do this, so that's now been fixed! Changes: https://github.com/rust-lang/backtrace-rs/compare/0.3.25...0.3.29 Closes #61416
2019-06-05Tidy: trailing whitespaceReinier Maas-1/+1
Removed trailing whitespace from documentation of ExitStatus.
2019-06-05Edit docs of ExitStatusReinier Maas-1/+4
The documentation of [`ExitStatus`] are extended to be at the same depth as [`Output`].
2019-06-04std: Update dependency on `backtrace`Alex Crichton-1/+1
Discovered in #61416 an accidental regression in libstd's backtrace behavior is that it previously attempted to consult libbacktrace and would then fall back to `dladdr` if libbacktrace didn't report anything. The `backtrace` crate, however, did not do this, so that's now been fixed! Changes: https://github.com/rust-lang/backtrace-rs/compare/0.3.25...0.3.27 Closes #61416
2019-06-04Hide gen_future API from documentationWim Looman-0/+6
2019-06-03Fix cfg(test) build for x86_64-fortanix-unknown-sgxJethro Beekman-1/+2
2019-06-02Fix missing semicolon in doc0x1793d1-1/+1
A semicolon is missing in the examples of compile_error. Macros that expand to items must be delimited with braces or followed by a semicolon.
2019-06-01Bump hashbrown to 0.4.0Amanieu d'Antras-1/+1
Fixes #61357
2019-06-01Auto merge of #60145 - little-dude:ip2, r=alexcrichtonbors-163/+781
std::net: Ipv4Addr and Ipv6Addr improvements Picking this up again from my previous PR: https://github.com/rust-lang/rust/pull/56050 Related to: https://github.com/rust-lang/rust/issues/27709 Fixes: https://github.com/rust-lang/rust/issues/57558 - add `add Ipv4Addr::is_reserved()` - [X] implementation - [X] tests - add `Ipv6Addr::is_unicast_link_local_strict()` and update `Ipv6Addr::is_unicast_link_local()` documentation - [X] implementation - [X] test - add `Ipv4Addr::is_benchmarking()` - [X] implementation - [X] test - add `Ipv4Addr::is_ietf_protocol_assignment()` - [X] implementation - [X] test - add `Ipv4Addr::is_shared()` - [X] implementation - [x] test - fix `Ipv4Addr:is_global()` - [X] implementation - [x] test - [X] refactor the tests for IP properties. This makes the tests more verbose, but using macros have two advantages: - it will now be easier to add tests for all the new methods - we get clear error messages when a test is failing. For instance: ``` ---- net::ip::tests::ip_properties stdout ---- thread '<unnamed>' panicked at 'assertion failed: !ip!("fec0::").is_global()', src/libstd/net/ip.rs:2036:9 ``` Whereas previously it was something like ``` thread '<unnamed>' panicked at 'assertion failed: `(left == right)` left: `true`, right: `false`', libstd/net/ip.rs:1948:13 ``` ----------------------- # Ongoing discussions: ## Should `Ipv4Addr::is_global()` return `true` or `false` for reserved addresses? Reserved addresses are addresses that are matched by `Ipv4Addr::is_reserved()`. @the8472 [pointed out](https://github.com/rust-lang/rust/pull/60145#issuecomment-485458319) that [RFC 4291](https://tools.ietf.org/html/rfc4291#section-2.4) says IPv6 reserved addresses should be considered global: ``` Future specifications may redefine one or more sub-ranges of the Global Unicast space for other purposes, but unless and until that happens, implementations must treat all addresses that do not start with any of the above-listed prefixes as Global Unicast addresses. ``` We could extrapolate that this should also be the case for IPv4. However, it seems that [IANA considers them non global](https://www.iana.org/assignments/ipv4-address-space/ipv4-address-space.xhtml) (see [my comment](https://github.com/rust-lang/rust/pull/60145#issuecomment-485713270)) ### Final decision There seems to be a consensus that reserved addresses have a different meaning for IPv4 and IPv6 ([comment1](https://github.com/rust-lang/rust/pull/60145#issuecomment-485963789) [comment2](https://github.com/rust-lang/rust/pull/60145#issuecomment-485944582), so we can consider that RFC4291 does not apply to IPv4, and that reserved IPv4 addresses are _not_ global. ## Should `Ipv6Addr::is_unicast_site_local()` exist? @pusateri [noted](https://github.com/rust-lang/rust/pull/60145#issuecomment-485507515) that site-local addresses have been deprecated for a while by [RFC 3879](https://tools.ietf.org/html/rfc3879) and new implementations _must not_ support them. However, since this method is stable, removing does not seem possible. This kind of situation is covered by the RFC which stated that existing implementation _may_ continue supporting site-local addresses. ### Final decision Let's keep this method. It is stable already, and the RFC explicitly states that existing implementation may remain. --------- Note: I'll be AFK from April 27th to May 11th. Anyone should feel free to pick this up if the PR hasn't been merged by then. Sorry for dragging that for so long already.
2019-05-31Rollup merge of #60897 - seanmonstar:patch-4, r=sfacklerPietro Albini-1/+7
error: remove StringError from Debug output Seeing `StringError("something something")` in debug output can cause someone to think there was an error dealing with `String`s, not that the error type is just a string. So, remove that noise. For example: ``` io error: Custom { kind: InvalidData, error: StringError("corrupt data") } ``` With this change: ``` io error: Custom { kind: InvalidData, error: "corrupt data" } ```
2019-05-29Auto merge of #61203 - memoryruins:bare_trait_objects, r=Centrilbors-10/+10
Warn on bare_trait_objects by default The `bare_trait_objects` lint is set to `warn` by default. Most ui tests have been updated to use `dyn` to avoid creating noise in stderr files. r? @Centril cc #54910
2019-05-29Rollup merge of #61235 - lzutao:stabilize-bufreader_buffer, r=CentrilMazdak Farrokhzad-4/+2
Stabilize bufreader_buffer feature FCP done in https://github.com/rust-lang/rust/issues/45323#issuecomment-495937047 Closes #45323 r? @SimonSapin
2019-05-29Update libstd doctests to use dynmemoryruins-10/+10
2019-05-29Rollup merge of #61202 - oberien:permissionext-print-octal, r=varkorMazdak Farrokhzad-2/+2
Print PermissionExt::mode() in octal in Documentation Examples Printing the file permission mode on unix systems in decimal feels unintuitive. Printing it in octal gives the expected form of e.g. `664`.
2019-05-29Rollup merge of #61157 - ↵Mazdak Farrokhzad-0/+35
czipperz:BufReader-Seek-remove-extra-discard_buffer, r=nikomatsakis BufReader: In Seek impl, remove extra discard_buffer call As far as I can tell, this code does nothing. I'm not sure why it even is there.
2019-05-27Stabilize bufreader_buffer featureLzu Tao-4/+2
2019-05-26Document tuple's Ord behavior as sequentialChris Gregory-0/+4
2019-05-26Print file mode of PermissionExt in octal in Examplesoberien-2/+2
2019-05-25std: Depend on `backtrace` crate from crates.ioAlex Crichton-2134/+165
This commit removes all in-tree support for generating backtraces in favor of depending on the `backtrace` crate on crates.io. This resolves a very longstanding piece of duplication where the standard library has long contained the ability to generate a backtrace on panics, but the code was later extracted and duplicated on crates.io with the `backtrace` crate. Since that fork each implementation has seen various improvements one way or another, but typically `backtrace`-the-crate has lagged behind libstd in one way or another. The goal here is to remove this duplication of a fairly critical piece of code and ensure that there's only one source of truth for generating backtraces between the standard library and the crate on crates.io. Recently I've been working to bring the `backtrace` crate on crates.io up to speed with the support in the standard library which includes: * Support for `StackWalkEx` on MSVC to recover inline frames with debuginfo. * Using `libbacktrace` by default on MinGW targets. * Supporting `libbacktrace` on OSX as an option. * Ensuring all the requisite support in `backtrace`-the-crate compiles with `#![no_std]`. * Updating the `libbacktrace` implementation in `backtrace`-the-crate to initialize the global state with the correct filename where necessary. After reviewing the code in libstd the `backtrace` crate should be at exact feature parity with libstd today. The backtraces generated should have the same symbols and same number of frames in general, and there's not known divergence from libstd currently. Note that one major difference between libstd's backtrace support and the `backtrace` crate is that on OSX the crates.io crate enables the `coresymbolication` feature by default. This feature, however, uses private internal APIs that aren't published for OSX. While they provide more accurate backtraces this isn't appropriate for libstd distributed as a binary, so libstd's dependency on the `backtrace` crate explicitly disables this feature and forces OSX to use `libbacktrace` as a symbolication strategy. The long-term goal of this refactoring is to eventually move us towards a world where we can drop `libbacktrace` entirely and simply use Gimli and the surrounding crates for backtrace support. That's still aways off but hopefully will much more easily enabled by having the source of truth for backtraces live in crates.io! Procedurally if we go forward with this I'd like to transfer the `backtrace-rs` crate to the rust-lang GitHub organization as well, but I figured I'd hold off on that until we get closer to merging.
2019-05-25Annotate test with #[test]Chris Gregory-0/+1
2019-05-25Add test that impl Seek for BufReader correctly invalidates buffer between seeksChris Gregory-0/+34
2019-05-23Fix typo "spit_paths", add linkBrent Kerby-1/+3
2019-05-23Rollup merge of #61057 - sfackler:revert-next-back, r=alexcrichtonMazdak Farrokhzad-24/+0
Revert "Add implementations of last in terms of next_back on a bunch of DoubleEndedIterators." This changed observable behavior for several iterator types. r? @alexcrichton
2019-05-22Revert "Add implementations of last in terms of next_back on a bunch of ↵Steven Fackler-24/+0
DoubleEndedIterators." This reverts commit 3e86cf36b5114f201868bf459934fe346a76a2d4.
2019-05-22Bump compiler-builtins to 0.1.15Alex Crichton-3/+3
This commit bumps the `compiler-builtins` dependency to 0.1.15 which expects to have the source for `compiler-rt` provided externally if the `c` feature is enabled. This then plumbs through the necessary support in the build system to ensure that if the `llvm-project` directory is checked out and present that we enable the `c` feature of `compiler-builtins` and compile in all the C intrinsics.
2019-05-22Rollup merge of #60581 - hellow554:fix_60580, r=alexcrichtonMazdak Farrokhzad-57/+46
convert custom try macro to `?` resolves #60580 r? @frewsxcv
2019-05-20Rollup merge of #60511 - taiki-e:libstd-intra-doc, r=Dylan-DPCMazdak Farrokhzad-2/+50
Fix intra-doc link resolution failure on re-exporting libstd Currently, re-exporting libstd items as below will [occur a lot of failures](https://gist.github.com/taiki-e/e33e0e8631ef47f65a74a3b69f456366). ```rust pub use std::*; ``` Until the underlying issue (#56922) fixed, we can fix that so they don't propagate to downstream crates. Related: https://github.com/rust-lang/rust/pull/56941 (That PR fixed failures that occur when re-exporting from libcore to libstd.) r? @QuietMisdreavus
2019-05-20Rollup merge of #60453 - tbu-:pr_getrandom_enoperm, r=sfacklerMazdak Farrokhzad-1/+6
Fall back to `/dev/urandom` on `EPERM` for `getrandom` This can happen because of seccomp or some VMs. Fixes #52609.
2019-05-20Auto merge of #60445 - RalfJung:maybe-uninit, r=Centrilbors-1/+0
stabilize core parts of MaybeUninit and deprecate mem::uninitialized in the future (1.40.0). This is part of implementing https://github.com/rust-lang/rfcs/pull/1892. Also expand the documentation a bit. This type is currently primarily useful when dealing with partially initialized arrays. In libstd, it is used e.g. in `BTreeMap` (with some unstable APIs that however can all be replaced, less ergonomically, by stable ones). What we stabilize should also be enough for `SmallVec` (Cc @bluss). Making this useful for structs requires https://github.com/rust-lang/rfcs/pull/2582 or a commitment that references to uninitialized data are not insta-UB.
2019-05-20stabilize core parts of MaybeUninit and deprecate mem::uninitialized in the ↵Ralf Jung-1/+0
future Also expand the documentation a bit
2019-05-20Auto merge of #60921 - cuviper:remove-mpsc_select, r=SimonSapinbors-1093/+9
Remove the unstable and deprecated mpsc_select This removes macro `select!` and `std::sync::mpsc::{Handle, Select}`, which were all unstable and have been deprecated since 1.32. Closes #27800 r? @SimonSapin
2019-05-18Simplify BufRead doc example using NLLBrent Kerby-9/+4
2019-05-17Auto merge of #60920 - Manishearth:rollup-p4xp4gk, r=Manishearthbors-2/+10
Rollup of 4 pull requests Successful merges: - #60791 (Update books) - #60891 (Allow claiming issues with triagebot) - #60901 (Handle more string addition cases with appropriate suggestions) - #60902 (Prevent Error::type_id overrides) Failed merges: r? @ghost
2019-05-17Remove the unstable and deprecated mpsc_selectJosh Stone-1093/+9
This removes macro `select!` and `std::sync::mpsc::{Handle, Select}`, which were all unstable and have been deprecated since 1.32.
2019-05-17Rollup merge of #60902 - sfackler:fix-error-soudness, r=alexcrichtonManish Goregaokar-2/+10
Prevent Error::type_id overrides type_id now takes an argument that can't be named outside of the std::error module, which prevents any implementations from overriding it. It's a pretty grody solution, and there's no way we can stabilize the method with this API, but it avoids the soudness issue! Closes #60784 r? @alexcrichton