summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2020-01-18Fix table of syscalls in docs of std::time::Instant.Mara Bos-2/+2
2020-01-18refactor fix using cfg_if! (fix build)Vita Batrla-6/+16
2020-01-17refactor fix using cfg_if!Vita Batrla-120/+55
2020-01-17Options IP_MULTICAST_TTL and IP_MULTICAST_LOOP are 1 byte on BSD and SolarisVita Batrla-18/+50
See ip(4P) man page: IP_MULTICAST_TTL Time to live for multicast datagrams. This option takes an unsigned character as an argument. Its value is the TTL that IP uses on outgoing multi- cast datagrams. The default is 1. IP_MULTICAST_LOOP Loopback for multicast datagrams. Normally multi- cast datagrams are delivered to members on the sending host (or sending zone). Setting the unsigned character argument to 0 causes the oppo- site behavior, meaning that when multiple zones are present, the datagrams are delivered to all zones except the sending zone. https://docs.oracle.com/cd/E88353_01/html/E37851/ip-4p.html https://man.openbsd.org/ip.4
2020-01-16Rollup merge of #68033 - ollie27:win_f32, r=dtolnayDylan DPC-57/+13
Don't use f64 shims for f32 cmath functions on non 32-bit x86 MSVC These shims are only needed on 32-bit x86. Additionally since https://reviews.llvm.org/rL268875 LLVM handles adding the shims itself for the intrinsics.
2020-01-16Rollup merge of #68266 - Stromberg90:patch-2, r=Dylan-DPCDylan DPC-4/+4
Changed docs for f32 and f64.
2020-01-16Rollup merge of #68223 - SOF3:float-fract-doc, r=varkorDylan DPC-8/+8
Use 3.6 instead of 3.5 in float fract() documentation It is not self-explanatory whether the fract() function inverts the fractional part of negative numbers. This change clarifies this possible question (so that it is `.6` not `.4`)
2020-01-16Rollup merge of #68096 - varkor:diagnostic-cleanup, r=CentrilDylan DPC-1/+1
Clean up some diagnostics by making them more consistent In general: - Diagnostic should start with a lowercase letter. - Diagnostics should not end with a full stop. - Ellipses contain three dots. - Backticks should encode Rust code. I also reworded a couple of messages to make them read more clearly. It might be sensible to create a style guide for diagnostics, so these informal conventions are written down somewhere, after which we could audit the existing diagnostics. r? @Centril
2020-01-16Update f32.rsStrømberg-1/+1
2020-01-16Update f64.rsStrømberg-2/+2
2020-01-16Update f32.rsStrømberg-1/+1
2020-01-15Use 3.6 instead of 3.5 in float fract() documentationSOFe-8/+8
It is not self-explanatory whether the fract() function inverts the fractional part of negative numbers. Co-Authored-By: Mateusz Mikuła <mati865@users.noreply.github.com>
2020-01-14Auto merge of #67711 - Amanieu:fix_unwind_leak, r=alexcrichtonbors-0/+9
Fix memory leak if C++ catches a Rust panic and discards it If C++ catches a Rust panic using `catch (...)` and then chooses not to rethrow it, the `Box<dyn Any>` in the exception may be leaked. This PR fixes this by adding the necessary destructors to the exception object. r? @Mark-Simulacrum
2020-01-14Auto merge of #67076 - mbrubeck:condvar, r=dtolnaybors-43/+34
Stabilize Condvar::wait_while and wait_timeout_while (previously wait_until, wait_timeout_until) Closes #47960.
2020-01-14Rollup merge of #68150 - tillarnold:master, r=cramertjYuki Okushi-0/+8
Document behavior of set_nonblocking on UnixListener The description on `set_nonblocking` in `UnixListener` was rather brief so I adapted it to be more like the documentation of `set_nonblocking` in `TcpListener`.
2020-01-12Fix system call docs for time::InstantRuud van Asseldonk-1/+1
The link for UNIX was pointing to the Cloud ABI docs. It should have been pointing to the clock_gettime docs instead. The table is repeated in the docs for SystemTime, but there the UNIX entry was already correct.
2020-01-12Don't include __rust_drop_panic when testing libstdAmanieu d'Antras-0/+1
2020-01-12Diagnostics should not end with a full stopvarkor-1/+1
2020-01-12Document behavior of set_nonblocking on UnixListenerTill Arnold-0/+8
2020-01-11Abort if C++ tries to swallow a Rust panicAmanieu d'Antras-0/+8
2020-01-11Rollup merge of #68102 - lzutao:inline, r=alexcrichtonMazdak Farrokhzad-1/+9
Inline some conversion methods around OsStr Diff on the assembly of this snippet before and after this PR: https://www.diffchecker.com/NeGMjaJ2 ```rust use std::env; use std::io; use std::path::{Path, PathBuf}; pub fn cargo_home_with_cwd(cwd: &Path) -> io::Result<PathBuf> { match env::var_os("CARGO_HOME").filter(|h| !h.is_empty()) { Some(home) => { let home = PathBuf::from(home); if home.is_absolute() { Ok(home) } else { Ok(cwd.join(&home)) } } _ => env::home_dir() .map(|p| p.join(".cargo")) .ok_or_else(|| io::Error::new(io::ErrorKind::Other, "could not find cargo home dir")), } } ```
2020-01-11Rollup merge of #67666 - lzutao:ptr-null-cmp, r=dtolnayMazdak Farrokhzad-20/+25
make use of pointer::is_null r? @Mark-Simulacrum
2020-01-10Auto merge of #65241 - tmiasko:no-std-san, r=alexcrichtonbors-10/+0
build-std compatible sanitizer support ### Motivation When using `-Z sanitizer=*` feature it is essential that both user code and standard library is instrumented. Otherwise the utility of sanitizer will be limited, or its use will be impractical like in the case of memory sanitizer. The recently introduced cargo feature build-std makes it possible to rebuild standard library with arbitrary rustc flags. Unfortunately, those changes alone do not make it easy to rebuild standard library with sanitizers, since runtimes are dependencies of std that have to be build in specific environment, generally not available outside rustbuild process. Additionally rebuilding them requires presence of llvm-config and compiler-rt sources. The goal of changes proposed here is to make it possible to avoid rebuilding sanitizer runtimes when rebuilding the std, thus making it possible to instrument standard library for use with sanitizer with simple, although verbose command: ``` env CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS=-Zsanitizer=thread cargo test -Zbuild-std --target x86_64-unknown-linux-gnu ``` ### Implementation * Sanitizer runtimes are no long packed into crates. Instead, libraries build from compiler-rt are used as is, after renaming them into `librusc_rt.*`. * rustc obtains runtimes from target libdir for default sysroot, so that they are not required in custom build sysroots created with build-std. * The runtimes are only linked-in into executables to address issue #64629. (in previous design it was hard to avoid linking runtimes into static libraries produced by rustc as demonstrated by sanitizer-staticlib-link test, which still passes despite changes made in #64780). cc @kennytm, @japaric, @firstyear, @choller
2020-01-10inline `impl From<String> for Box<dyn Error + Send + Sync>`Lzu Tao-0/+2
2020-01-10inline `impl AsRef<Path> for PathBuf`Lzu Tao-0/+1
2020-01-10inline `impl AsRef<OsStr> for OsString`Lzu Tao-0/+1
2020-01-10Inline `impl From<OsString> for PathBuf`Lzu Tao-0/+1
2020-01-10Inline `AsRef<Path> for str`Lzu Tao-0/+1
2020-01-10Inline PathBuf::deref to make it zero costLzu Tao-1/+1
2020-01-10Inline to make OsStr::is_empty zero costLzu Tao-0/+2
2020-01-10make use of pointer::is_nullLzu Tao-20/+25
2020-01-10Rollup merge of #67358 - cuviper:get_or_insert_owned, r=LukasKalbertodtYuki Okushi-0/+32
Add HashSet::get_or_insert_owned This is an extension for tracking issue #60896. The more-general `get_or_insert_with` has potential for misuse, so we might remove it, but I think `get_or_insert_owned` covers most use cases.
2020-01-09stabalize ManuallyDrop::takeCAD97-1/+0
2020-01-09Remove sanitizer runtime cratesTomasz Miąsko-10/+0
2020-01-08Add HashSet::get_or_insert_ownedJosh Stone-0/+32
2020-01-09Rollup merge of #67966 - popzxc:core-std-matches, r=CentrilMazdak Farrokhzad-34/+8
Use matches macro in libcore and libstd This PR replaces matches like ```rust match var { value => true, _ => false, } ``` with use of `matches!` macro. r? @Centril
2020-01-08Don't use f64 shims for f32 cmath functions on none 32-bit x86 MSVCOliver Middleton-57/+13
These shims are only needed on 32-bit x86. Additionally since https://reviews.llvm.org/rL268875 LLVM handles adding the shims itself for the intrinsics.
2020-01-09Rollup merge of #67985 - dtolnay:cstr, r=Mark-SimulacrumYuki Okushi-10/+0
Remove insignificant notes from CStr documentation The to_str and to_string_lossy methods contain a note about the behavior possibly changing in the future. But those notes are referring to a distinction that is not observable in the API. Whether or not the UTF-8 check knows the string length ahead of time, these methods require linear time.
2020-01-09Rollup merge of #67977 - Wind-River:master_2020, r=alexcrichtonYuki Okushi-66/+2
Updates for VxWorks r? @alexcrichton
2020-01-08Try statx for all linux-gnu targetsoxalica-28/+6
2020-01-08Use matches macro in libcore and libstdIgor Aleksanov-34/+8
2020-01-07Remove insignificant notes from CStr documentationDavid Tolnay-10/+0
These notes are about a distinction that is not going to be observable in the API. Whether or not the UTF-8 check knows the string length ahead of time, these methods require linear time.
2020-01-07Rollup merge of #67943 - Stromberg90:patch-1, r=jonas-schievinkYuki Okushi-2/+1
Missing module std in example.
2020-01-07Rollup merge of #67566 - Mark-Simulacrum:thread-id-u64, r=alexcrichtonYuki Okushi-0/+13
Add an unstable conversion from thread ID to u64 We see multiple cases inside rustc and ecosystem code where ThreadId is transmuted to u64, exploiting the underlying detail. This is suboptimal (can break unexpectedly if we change things in std). It is unlikely that ThreadId will ever need to be larger than u64 -- creating even 2^32 threads over the course of a program is quite hard, 2^64 is even harder. As such, we do not choose to return a larger sized type (e.g. u128). If we choose to shrink ThreadId in the future, or otherwise change its internals, it is likely that a mapping to u64 will still be applicable (though may become more complex). I will file a tracking issue as soon as this is loosely approved.
2020-01-06ignore signal SIGPIPEBaoshanPang-10/+2
2020-01-06Auto merge of #66899 - msizanoen1:riscv-std, r=alexcrichtonbors-4/+20
Standard library support for riscv64gc-unknown-linux-gnu Add std support for RISC-V 64-bit GNU/Linux and update libc for RISC-V support. r? @alexcrichton
2020-01-06Remove weak.rs for VxWorksUmesh Kalappa-56/+0
2020-01-06Removed module usage.Strømberg-1/+0
2020-01-06Missing module std in example.Strømberg-1/+1
2020-01-06Add an unstable conversion from thread ID to u64Mark Rousskov-0/+13
We see multiple cases inside rustc and ecosystem code where ThreadId is transmuted to u64, exploiting the underlying detail. This is suboptimal (can break unexpectedly if we change things in std). It is unlikely that ThreadId will ever need to be larger than u64 -- creating even 2^32 threads over the course of a program is quite hard, 2^64 is even harder. As such, we do not choose to return a larger sized type (e.g. u128). If we choose to shrink ThreadId in the future, or otherwise change its internals, it is likely that a mapping to u64 will still be applicable (though may become more complex).