about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2017-12-18Add lossless debug implementation for unix OsStrsDiggory Blake-3/+63
2017-12-17add aarch64-unknown-openbsd supportSébastien Marie-0/+2
- make liblibc to point to libc with aarch64-unknown-openbsd - make c_char (in std::os::raw) to point to right value
2017-12-15Rollup merge of #46710 - xfix:patch-5, r=alexcrichtonSteve Klabnik-3/+0
Remove Sync and Send implementation for RawTable The implementation was introduced when changing hash storage from Unique to *mut, but it was changed back to Unique.
2017-12-14Auto merge of #45002 - oli-obk:miri, r=eddybbors-2/+2
Validate miri against the HIR const evaluator r? @eddyb cc @alexcrichton @arielb1 @RalfJung The interesting parts are the last few functions in `librustc_const_eval/eval.rs` * We warn if miri produces an error while HIR const eval does not. * We warn if miri produces a value that does not match the value produced by HIR const eval * if miri succeeds and HIR const eval fails, nothing is emitted, but we still return the HIR error * if both error, nothing is emitted and the HIR const eval error is returned So there are no actual changes, except that miri is forced to produce the same values as the old const eval. * This does **not** touch the const evaluator in trans at all. That will come in a future PR. * This does **not** cause any code to compile that didn't compile before. That will also come in the future It would be great if someone could start a crater run if travis passes
2017-12-13Remove Sync and Send implementation for RawTableKonrad Borowski-3/+0
The implementation was introduced when changing hash storage from Unique to *mut, but it was changed back to Unique.
2017-12-13Move rust memchr impl to libcoreManish Goregaokar-232/+5
2017-12-12Rename never_type_impls gate to never_typeAndrew Cann-2/+2
2017-12-11Reject superfluous `::` in IPv6 addressesvarkor-1/+6
Fixes #46263.
2017-12-11Add more Duration methods for consistency.Clar Charr-1/+62
2017-12-11Merge remote-tracking branch 'origin/master' into miriOliver Schneider-39/+303
2017-12-10Auto merge of #46232 - canndrew:never-docs, r=QuietMisdreavusbors-0/+128
Add docs for never primitive cc @nikomatsakis, @QuietMisdreavus
2017-12-10Update never_type docs based on feedbackAndrew Cann-1/+2
2017-12-09Use Try syntax for Option in place of macros or matchMatt Brubeck-35/+13
2017-12-08Auto merge of #45837 - SimonSapin:file_read_write, r=dtolnaybors-1/+134
Add read, read_string, and write functions to std::fs New APIs in `std::fs`: ```rust pub fn read<P: AsRef<Path>>(path: P) -> io::Result<Vec<u8>> { … } pub fn read_string<P: AsRef<Path>>(path: P) -> io::Result<String> { … } pub fn write<P: AsRef<Path>, C: AsRef<[u8]>>(path: P, contents: C) -> io::Result<()> { ... } ``` (`read_string` is based on `read_to_string` and so returns an error on non-UTF-8 content.) Before: ```rust use std::fs::File; use std::io::Read; let mut bytes = Vec::new(); File::open(filename)?.read_to_end(&mut bytes)?; do_something_with(bytes) ``` After: ```rust use std::fs; do_something_with(fs::read(filename)?) ```
2017-12-08fs::{read, read_string, write}: add tracking issue numberSimon Sapin-3/+3
2017-12-07Rollup merge of #46416 - liigo:cfg-macro, r=steveklabnikGuillaume Gomez-1/+1
doc: macro `cfg!` evaluating at compile-time
2017-12-06Rename fs::read_utf8 to read_stringSimon Sapin-4/+4
2017-12-06Update miri to rustc changesOliver Schneider-2454/+5628
2017-12-05compile_error example blurbsHavvy-0/+5
2017-12-05No unused macro warning in compile_error example.Havvy-1/+4
2017-12-04Give compile_error macro examplesHavvy-2/+19
2017-12-04Auto merge of #46485 - khuey:cursor-read_exact, r=Manishearthbors-0/+25
Add a specialization of read_exact for Cursor. The read_exact implementation for &[u8] is optimized and usually allows LLVM to reduce a read_exact call for small numbers of bytes to a bounds check and a register load instead of a generic memcpy. On a workload I have that decompresses, deserializes (via bincode), and processes some data, this leads to a 40% speedup by essentially eliminating the deserialization overhead entirely.
2017-12-03Add a specialization of read_exact for Cursor.Kyle Huey-0/+25
The read_exact implementation for &[u8] is optimized and usually allows LLVM to reduce a read_exact call for small numbers of bytes to a bounds check and a register load instead of a generic memcpy. On a workload I have that decompresses, deserializes (via bincode), and processes some data, this leads to a 40% speedup by essentially eliminating the deserialization overhead entirely.
2017-12-03Rollup merge of #46260 - ExpHP:builtin-macro-doc-sync, r=steveklabnikCorey Farwell-6/+14
Make doc stubs for builtin macros reflect existing support for trailing commas This modifies the `macro_rules!` stubs in `std` for some of the compiler builtin macros in order to better reflect their currently supported grammar. To my understanding these stubs have no impact on compiler output whatsoever, and only exist so that they may appear in the documentation. P.S. It is in fact true that `env!` supports trailing commas while `option_env!` currently does not. (I have another issue for this) I don't imagine there's any way to automatically test these stubs, but I did *informally* test the new definitions on the playpen to see that they accept the desired invocations, as well as inspect the updated doc output.
2017-12-02Auto merge of #46382 - alexcrichton:thinlto-default, r=michaelwoeristerbors-2/+20
rustc: Prepare to enable ThinLTO by default This commit *almost* enables ThinLTO and multiple codegen units in release mode by default but is blocked on #46346 now before pulling the trigger.
2017-12-02Auto merge of #46288 - alexcrichton:bump-bootstrap, r=Mark-Simulacrumbors-200/+0
Bump to 1.24.0 * Update the in-tree version number * Update the bootstrap compiler * Remove `cfg(stage0)` annotations * Update crate dependencies * Update Cargo itself
2017-12-01doc: macro `cfg!` evaluating at compile-timeLiigo Zhuang-1/+1
2017-11-30NetBSD: add sysctl backend for std::env::current_exeJonathan A. Kollasch-1/+28
Use the CTL_KERN.KERN_PROC_ARGS.-1.KERN_PROC_PATHNAME sysctl in preference over the /proc/curproc/exe symlink. Additionally, perform more validation of aformentioned symlink. Particularly on pre-8.x NetBSD this symlink will point to '/' when accurate information is unavailable.
2017-11-30rustc: Prepare to enable ThinLTO by defaultAlex Crichton-2/+20
This commit prepares to enable ThinLTO and multiple codegen units in release mode by default. We've still got a debuginfo bug or two to sort out before actually turning it on by default.
2017-11-29Update bootstrap compilerAlex Crichton-200/+0
Also remove a number of `stage0` annotations and such
2017-11-29Generalize fs::write from &[u8] to AsRef<[u8]>Simon Sapin-3/+3
2017-11-29Rollup merge of #46323 - ia0:fix_mpsc_error_conv, r=kennytmkennytm-3/+3
Fix since for mpsc_error_conversions This is a followup of #45506.
2017-11-29Rollup merge of #46287 - SimonSapin:stable-constness, r=aturonkennytm-12/+0
Stabilize const-calling existing const-fns in std Fixes #46038
2017-11-29Rollup merge of #46077 - LukasKalbertodt:stabilize-ascii-ctype, r=alexcrichtonkennytm-43/+166
Stabilize some `ascii_ctype` methods As discussed in #39658, this PR stabilizes those methods for `u8` and `char`. All inherent `ascii_ctype` for `[u8]` and `str` are removed as we prefer the more explicit version `s.chars().all(|c| c.is_ascii_())`. This PR doesn't modify the `AsciiExt` trait. There, the `ascii_ctype` methods are still unstable. It is planned to remove those in the future (I think). I had to modify some code in `ascii.rs` to properly implement `AsciiExt` for all types. Fixes #39658.
2017-11-29Rollup merge of #45969 - ia0:mpsc_recv_deadline, r=alexcrichtonkennytm-2/+63
Add std::sync::mpsc::Receiver::recv_deadline() Essentially renames recv_max_until to recv_deadline (mostly copying recv_timeout documentation). This function is useful to avoid the often unnecessary call to Instant::now in recv_timeout (e.g. when the user already has a deadline). A concrete example would be something along those lines: ```rust use std::sync::mpsc::Receiver; use std::time::{Duration, Instant}; /// Reads a batch of elements /// /// Returns as soon as `max_size` elements have been received or `timeout` expires. fn recv_batch_timeout<T>(receiver: &Receiver<T>, timeout: Duration, max_size: usize) -> Vec<T> { recv_batch_deadline(receiver, Instant::now() + timeout, max_size) } /// Reads a batch of elements /// /// Returns as soon as `max_size` elements have been received or `deadline` is reached. fn recv_batch_deadline<T>(receiver: &Receiver<T>, deadline: Instant, max_size: usize) -> Vec<T> { let mut result = Vec::new(); while let Ok(x) = receiver.recv_deadline(deadline) { result.push(x); if result.len() == max_size { break; } } result } ```
2017-11-28Fix doc test of previous commitJulien Cretin-0/+2
2017-11-28Add more links to `!` doc textAndrew Cann-18/+28
2017-11-28Fix since for mpsc_error_conversionsJulien Cretin-3/+3
2017-11-27Use an unstable feature linked to #46316Julien Cretin-1/+1
2017-11-28Rollup merge of #45506 - ia0:mpsc_recv_error_from, r=alexcrichtonkennytm-0/+27
Implement From<RecvError> for TryRecvError and RecvTimeoutError According to the documentation, it looks to me that `TryRecvError` and `RecvTimeoutError` are strict extensions of `RecvError`. As such, it makes sense to allow conversion from the latter type to the two former types without constraining future developments. This permits to write `input.recv()?` and `input.recv_timeout(timeout)?` in the same function for example.
2017-11-26Stabilize const-calling existing const-fns in stdSimon Sapin-12/+0
Fixes #46038
2017-11-26fix NetBSDAriel Ben-Yehuda-1/+2
2017-11-26Auto merge of #46272 - kennytm:rollup, r=kennytmbors-2/+1
Rollup of 7 pull requests - Successful merges: #46201, #46224, #46234, #46252, #46259, #46264, #46269 - Failed merges:
2017-11-26Rollup merge of #46224 - GuillaumeGomez:io-missing-link, r=QuietMisdreavuskennytm-2/+1
Remove invalid doc link r? @rust-lang/docs
2017-11-25Implement `Rc`/`Arc` conversions for string-like typesMurarth-0/+283
Provides the following conversion implementations: * `From<`{`CString`,`&CStr`}`>` for {`Arc`,`Rc`}`<CStr>` * `From<`{`OsString`,`&OsStr`}`>` for {`Arc`,`Rc`}`<OsStr>` * `From<`{`PathBuf`,`&Path`}`>` for {`Arc`,`Rc`}`<Path>`
2017-11-25Make builtin macro doc stubs more accurateMichael Lamparski-6/+14
See #46242.
2017-11-25rustbuild: Enable WebAssembly backend by defaultAlex Crichton-76/+111
This commit alters how we compile LLVM by default enabling the WebAssembly backend. This then also adds the wasm32-unknown-unknown target to get compiled on the `cross` builder and distributed through rustup. Tests are not yet enabled for this target but that should hopefully be coming soon!
2017-11-24std: Flag Windows TLS dtor symbol as #[used]Alex Crichton-1/+3
Turns out ThinLTO was internalizing this symbol and eliminating it. Worse yet if you compiled with LTO turns out no TLS destructors would run on Windows! The `#[used]` annotation should be a more bulletproof implementation (in the face of LTO) of preserving this symbol all the way through in LLVM and ensuring it makes it all the way to the linker which will take care of it.
2017-11-24Auto merge of #46012 - Gankro:float-conv-transmute, r=sfacklerbors-76/+86
Make float::from_bits transmute See commit message for details. See also this discussion here: https://github.com/rust-lang/rust/issues/40470#issuecomment-343803381 (may require libs team discussion before merging)
2017-11-24Fix doc testsAndrew Cann-9/+22