about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2018-06-26Make feature unstablejD91mZM2-40/+1
2018-06-26Custom feature gate (I think?)jD91mZM2-40/+40
2018-06-26Trim all lines to 100jD91mZM2-3/+10
2018-06-26Make UnixStream::take_error return None on redoxjD91mZM2-3/+3
2018-06-26Unix sockets on redox!jD91mZM2-1/+733
2018-06-26migrate codebase to `..=` inclusive range patternsZack M. Davis-7/+7
These were stabilized in March 2018's #47813, and are the Preferred Way to Do It going forward (q.v. #51043).
2018-06-26Add read_exact_at and write_all_at methods to FileExt on unixDror Levin-0/+127
2018-06-26Clarify rational behind current implementation of `.mod_euc()`Fabian Kössel-0/+8
2018-06-26Document round-off error in `.mod_euc()`-method, see issue #50179Fabian Kössel-2/+12
2018-06-26Rollup merge of #51786 - cuviper:stat64-pointers, r=Mark-SimulacrumPietro Albini-2/+2
Remove unnecessary stat64 pointer casts In effect, these just casted `&mut stat64` to `*mut stat64`, twice. That's harmless, but it masked a problem when this was copied to new code calling `fstatat`, which takes a pointer to `struct stat`. That will be fixed by #51785, but let's remove the unnecessary casts here too.
2018-06-26Rollup merge of #51730 - MajorBreakfast:pin-get-mut-unchecked, r=withoutboatsPietro Albini-9/+4
New safe associated functions for PinMut - Add safe `get_mut` and `map` - Rename unsafe equivalents to `get_mut_unchecked` and `map_unchecked` The discussion about this starts [in this comment](https://github.com/rust-lang/rust/issues/49150#issuecomment-399604573) on the tracking issue.
2018-06-26Rollup merge of #51642 - GuillaumeGomez:fix-unknown-windows-build, r=oli-obkPietro Albini-0/+3
Fix unknown windows build Fixes #51618.
2018-06-26Rollup merge of #51153 - ogham:panic-and-compile_error-docs, r=GuillaumeGomezPietro Albini-2/+10
Link panic and compile_error docs This adds documentation links between `panic!()` and `compile_error!()` as per #47275, which points out that they’re similar. It also adds a sentence to the `compile_error()` docs I thought could be added.
2018-06-26Auto merge of #50630 - sharkdp:fix-50619, r=sfacklerbors-7/+24
Fix possibly endless loop in ReadDir iterator Certain directories in `/proc` can cause the `ReadDir` iterator to loop indefinitely. We get an error code (22) when calling libc's `readdir_r` on these directories, but `entry_ptr` is `NULL` at the same time, signalling the end of the directory stream. This change introduces an internal state to the iterator such that the `Some(Err(..))` value will only be returned once when calling `next`. Subsequent calls will return `None`. fixes #50619
2018-06-25Remove unnecessary stat64 pointer castsJosh Stone-2/+2
In effect, these just casted `&mut stat64` to `*mut stat64`, twice. That's harmless, but it masked a problem when this was copied to new code calling `fstatat`, which takes a pointer to `struct stat`. That will be fixed by #51785, but let's remove the unnecessary casts here too.
2018-06-25Use fstatat64 where availableJosh Stone-6/+5
2018-06-25Add missing \[allow(missing_docs)\]Guillaume Gomez-0/+1
2018-06-25Add sentence to compile_error!() docsBenjamin Sago-1/+3
It now details why using compile_error!() is different from just not having the final macro_rules!() branch.
2018-06-25Link the docs of panic!() and compile_error!()Benjamin Sago-1/+7
Fixes #47275. These two macros are similar, but different, and could do with documentation links to each other.
2018-06-24Haiku: fix build of libbacktraceNiels Sascha Reedijk-1/+2
2018-06-23`PinMut`: Add safe `get_mut` and rename unsafe fns to `get_mut_unchecked` ↵Josef Reinhard Brandl-9/+4
and `map_unchecked`
2018-06-23Auto merge of #51580 - cramertj:async-await, r=eddybbors-16/+152
async/await This PR implements `async`/`await` syntax for `async fn` in Rust 2015 and `async` closures and `async` blocks in Rust 2018 (tracking issue: https://github.com/rust-lang/rust/issues/50547). Limitations: non-`move` async closures with arguments are currently not supported, nor are `async fn` with multiple different input lifetimes. These limitations are not fundamental and will be removed in the future, however I'd like to go ahead and get this PR merged so we can start experimenting with this in combination with futures 0.3. Based on https://github.com/rust-lang/rust/pull/51414. cc @petrochenkov for parsing changes. r? @eddyb
2018-06-22Remove impl trait names and move bits of await into a functionTaylor Cramer-13/+21
2018-06-22Review nits and updatesTaylor Cramer-38/+35
Move future_from_generator out of raw Update await to use $crate Renumber errors
2018-06-22Rollup merge of #51637 - abarth:new_prng, r=cramertjkennytm-4/+3
Update zx_cprng_draw_new on Fuchsia Fuchsia is changing the semantics for zx_cprng_draw and zx_cprng_draw_new is a temporary name for the new semantics.
2018-06-21Allow unsafe code inside of await macroTaylor Cramer-0/+1
2018-06-21async await desugaring and testsTaylor Cramer-2/+132
2018-06-22Auto merge of #51463 - estebank:error-codes, r=nikomatsakisbors-5/+10
Various changes to existing diagnostics * [Add code to `invalid ABI` error, add span label, move list to help to make message shorter](https://github.com/rust-lang/rust/pull/51463/commits/23ae5af274defa9ff884f593e44a2bbcaf814a02): ``` error[E0697]: invalid ABI: found `路濫狼á́́` --> $DIR/unicode.rs:11:8 | LL | extern "路濫狼á́́" fn foo() {} //~ ERROR invalid ABI | ^^^^^^^^^ invalid ABI | = help: valid ABIs: cdecl, stdcall, fastcall, vectorcall, thiscall, aapcs, win64, sysv64, ptx-kernel, msp430-interrupt, x86-interrupt, Rust, C, system, rust-intrinsic, rust-call, platform-intrinsic, unadjusted ``` * [Add code to incorrect `pub` restriction error](https://github.com/rust-lang/rust/pull/51463/commits/e96fdea8a38f39f99f8b9a4000a689187a457e08) * [Add message to `rustc_on_unimplemented` attributes in core to have them set a custom message _and_ label](https://github.com/rust-lang/rust/pull/51463/commits/2cc7e5ed307aee936c20479cfdc7409d6b52a464): ``` error[E0277]: `W` does not have a constant size known at compile-time --> $DIR/unsized-enum2.rs:33:8 | LL | VA(W), | ^ `W` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `W` = help: consider adding a `where W: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type ``` ``` error[E0277]: `Foo` cannot be sent between threads safely --> $DIR/E0277-2.rs:26:5 | LL | is_send::<Foo>(); | ^^^^^^^^^^^^^^ `Foo` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `Foo` ``` ``` error[E0277]: can't compare `{integer}` with `std::string::String` --> $DIR/binops.rs:16:7 | LL | 5 < String::new(); | ^ no implementation for `{integer} < std::string::String` and `{integer} > std::string::String` | = help: the trait `std::cmp::PartialOrd<std::string::String>` is not implemented for `{integer}` ``` ``` error[E0277]: can't compare `{integer}` with `std::result::Result<{integer}, _>` --> $DIR/binops.rs:17:7 | LL | 6 == Ok(1); | ^^ no implementation for `{integer} == std::result::Result<{integer}, _>` | = help: the trait `std::cmp::PartialEq<std::result::Result<{integer}, _>>` is not implemented for `{integer}` ``` ``` error[E0277]: a collection of type `i32` cannot be built from an iterator over elements of type `i32` --> $DIR/type-check-defaults.rs:16:19 | LL | struct WellFormed<Z = Foo<i32, i32>>(Z); | ^ a collection of type `i32` cannot be built from `std::iter::Iterator<Item=i32>` | = help: the trait `std::iter::FromIterator<i32>` is not implemented for `i32` note: required by `Foo` --> $DIR/type-check-defaults.rs:15:1 | LL | struct Foo<T, U: FromIterator<T>>(T, U); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` * [Add link to book for `Sized` errors](https://github.com/rust-lang/rust/pull/51463/commits/1244dc7c283323aea1a3457a4458d590a3e160c8): ``` error[E0277]: `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time --> $DIR/const-unsized.rs:13:29 | LL | const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync)); | ^^^^^^^^^^^^^^^^^^^^^^ `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `std::fmt::Debug + std::marker::Sync + 'static` = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized> = note: constant expressions must have a statically known size ``` * [Point to previous line for single expected token not found](https://github.com/rust-lang/rust/pull/51463/commits/48165168fb0f059d8536cd4a2276b609d4a7f721) (if the current token is in a different line)
2018-06-19Remove erroneous example of main as a non-Result function.Sgeo-1/+1
2018-06-19Add message to `rustc_on_unimplemented` attributes in coreEsteban Küber-5/+10
2018-06-20Fix doc build on unknown windows targetGuillaume Gomez-0/+2
2018-06-19Auto merge of #51543 - SimonSapin:oom, r=SimonSapinbors-16/+16
Rename OOM to allocation error The acronym is not descriptive unless one has seen it before. * Rename the `oom` function to `handle_alloc_error`. It was **stabilized in 1.28**, so if we do this at all we need to land it this cycle. * Rename `set_oom_hook` to `set_alloc_error_hook` * Rename `take_oom_hook` to `take_alloc_error_hook` Bikeshed: `on` v.s. `for`, `alloc` v.s. `allocator`, `error` v.s. `failure`
2018-06-19Update zx_cprng_draw_new on FuchsiaAdam Barth-4/+3
Fuchsia is changing the semantics for zx_cprng_draw and zx_cprng_draw_new is a temporary name for the new semantics.
2018-06-19Auto merge of #51081 - kornelski:examplestr, r=steveklabnikbors-23/+37
Use String, not &str in some collection examples Discussed in #46966 Overuse of borrowed values in data structures is a common mistake I see in Rust user forums. Users who copy&paste such examples end up fighting with the borrow checker as soon as they replace string literals with some real values. This changes a couple of examples to use `String`, and it adds opportunity to demonstrate use of `Borrow`.
2018-06-18Rename OOM to allocation errorSimon Sapin-16/+16
The acronym is not descriptive unless one has seen it before. * Rename the `oom` function to `handle_alloc_error`. It was **stabilized in 1.28**, so if we do this at all we need to land it this cycle. * Rename `set_oom_hook` to `set_alloc_error_hook` * Rename `take_oom_hook` to `take_alloc_error_hook` Bikeshed: `alloc` v.s. `allocator`, `error` v.s. `failure`
2018-06-18Stabilize std::path::Path:ancestorsTobias Stolzmann-8/+4
2018-06-18Prefer use of owned values in examplesKornel-23/+37
2018-06-17Auto merge of #51529 - nodakai:improve-sys_common-mutex, r=oli-obkbors-69/+73
libstd: add an RAII utility for sys_common::mutex::Mutex It is indeed debatable whether or not we should introduce more sophistication like this to the lowest layer of a system library. In fact, `Drop::drop()` cannot be `unsafe` (IIRC there was a discussion on introducing an unsafe variant of `Drop` whose entire scope must be within `unsafe`)
2018-06-17Auto merge of #51555 - ccesare:remove_unused_variables_redox_os, r=kennytmbors-3/+0
Removed two unused variables in os.rs Issue #51419 suggested removing two unused variables in `libstd/sys/redox/os.rs`. This PR implements that change. It compiles for me locally, but I haven't run any other tests.
2018-06-17libstd: add an RAII utility for sys_common::mutex::MutexNODA, Kai-69/+73
Signed-off-by: NODA, Kai <nodakai@gmail.com>
2018-06-17Auto merge of #51382 - GuillaumeGomez:intra-link-lint, r=QuietMisdreavusbors-0/+2
Add lint for intra link resolution failure This PR is almost done, just remains this note: ``` note: requested on the command line with `-W intra-link-resolution-failure` ``` I have no idea why my lint is considered as being passed through command line and wasn't able to find where it was set. If anyone has an idea, it'd be very helpful! cc @QuietMisdreavus
2018-06-15Add doc for fn keywordGuillaume Gomez-0/+33
2018-06-15Fix issue on unixGuillaume Gomez-0/+1
2018-06-14Removed two unused variablesChris Cesare-3/+0
2018-06-13Add missing allow_missing_docsGuillaume Gomez-0/+1
2018-06-12Fix possibly endless loop in ReadDir iteratorsharkdp-7/+24
Certain directories in `/proc` can cause the `ReadDir` iterator to loop indefinitely. We get an error code (22) when calling libc's `readdir_r` on these directories, but `entry_ptr` is `NULL` at the same time, signalling the end of the directory stream. This change introduces an internal state to the iterator such that the `Some(Err(..))` value will only be returned once when calling `next`. Subsequent calls will return `None`. fixes #50619
2018-06-12Auto merge of #51241 - glandium:globalalloc, r=sfackler,SimonSapinbors-23/+84
Stabilize GlobalAlloc and #[global_allocator] This PR implements the changes discussed in https://github.com/rust-lang/rust/issues/49668#issuecomment-393263510 Fixes #49668 Fixes #27389 This does not change the default global allocator: #36963
2018-06-11Move Unstable Book sections for #[global_allocator] and System to std::alloc ↵Simon Sapin-0/+62
docs
2018-06-11Remove some '#[feature]' attributes for stabilized featuresSimon Sapin-1/+0
2018-06-11Stabilize the `System` allocatorSimon Sapin-1/+1