about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2018-01-30Implement extensible syscall interface for wasmDiggory Blake-129/+260
2018-01-30std: use more portable error number in from_raw_os_error docsJames Cowgill-4/+4
On MIPS, error number 98 is not EADDRINUSE (it is EPROTOTYPE). To fix the resulting test failure this causes, use a more portable error number in the example documentation. EINVAL shold be more reliable because it was defined in the original Unix as 22 so hopefully most derivatives have defined it the same way.
2018-01-30Rollup merge of #47839 - frewsxcv:frewsxcv-map-index, r=QuietMisdreavuskennytm-2/+7
Document that `Index` ops can panic on `HashMap` & `BTreeMap`. Fixes https://github.com/rust-lang/rust/issues/47011.
2018-01-30Rollup merge of #47760 - little-dude:master, r=alexcrichtonkennytm-5/+17
implement Send for process::Command on unix closes https://github.com/rust-lang/rust/issues/47751
2018-01-29Move time::Duration to libcoreClar Charr-593/+1
2018-01-29Reworded to avoid fuzziness, mention ! in c_void docs.Clar Charr-13/+23
2018-01-29Revisions suggested in commentsClar Charr-6/+4
2018-01-29Document std::os::raw.Clar Charr-5/+116
2018-01-28Document that `Index` ops can panic on `HashMap` & `BTreeMap`.Corey Farwell-2/+7
Fixes https://github.com/rust-lang/rust/issues/47011.
2018-01-27Make wording around 0-cost casts more preciseTobias Bucher-9/+9
2018-01-26add test checking that process::Command is SendCorentin Henry-0/+6
2018-01-26make Command.argv Send on unix platformsCorentin Henry-10/+11
Implementing Send for a specific field rather than the whole struct is safer: if a field is changed/modified and becomes non-Send, we can catch it.
2018-01-26Print inlined functions on WindowsJohn Kåre Alsaker-37/+59
2018-01-25implement Send for process::Command on unixCorentin Henry-0/+5
closes https://github.com/rust-lang/rust/issues/47751
2018-01-25Auto merge of #47006 - bitshifter:stabilize-repr-align, r=eddybbors-1/+1
Stabilized `#[repr(align(x))]` attribute (RFC 1358) Stabilzed `#[repr(align(x))]` with attr_literal syntax as proposed by @eddyb https://github.com/rust-lang/rust/issues/33626#issuecomment-348467804
2018-01-24Add missing micro version number component in stability attributes.Simon Sapin-4/+4
2018-01-24Auto merge of #47300 - remexre:duration-constructors-as-const-fns, ↵bors-13/+16
r=alexcrichton Makes the constructors of Duration const fns. This affects `Duration::new`, `Duration::from_secs`, `Duration::from_millis`, `Duration::from_micros`, and `Duration::from_nanos`.
2018-01-24Auto merge of #47299 - cramertj:unsafe-placer, r=alexcrichtonbors-1/+1
Make core::ops::Place an unsafe trait Consumers of `Place` would reasonably expect that the `pointer` function returns a valid pointer to memory that can actually be written to.
2018-01-24Auto merge of #46931 - clarcharr:float_bits_core, r=alexcrichtonbors-6/+4
Expose float from_bits and to_bits in libcore. These methods have no dependencies on libm and thus should be offered in libcore.
2018-01-23Make PanicInfo::message available for std::panic! with a formatting string.Simon Sapin-6/+7
This enables PanicInfo’s Display impl to show the panic message in those cases.
2018-01-23Add an unstable PanicInfo::message(&self) -> Option<&fmt::Arguments> methodSimon Sapin-0/+1
2018-01-23Move PanicInfo and Location to libcoreSimon Sapin-190/+16
Per https://rust-lang.github.io/rfcs/2070-panic-implementation.html
2018-01-23Stabilized `#[repr(align(x))]` attribute (RFC 1358)Cameron Hart-1/+1
2018-01-21Rollup merge of #47334 - etaoins:only-call-res-init-on-gnu-unix, r=alexcrichtonGuillaume Gomez-32/+16
Only link res_init() on GNU/*nix To workaround a bug in glibc <= 2.26 lookup_host() calls res_init() based on the glibc version detected at runtime. While this avoids calling res_init() on platforms where it's not required we will still end up linking against the symbol. This causes an issue on macOS where res_init() is implemented in a separate library (libresolv.9.dylib) from the main libc. While this is harmless for standalone programs it becomes a problem if Rust code is statically linked against another program. If the linked program doesn't already specify -lresolv it will cause the link to fail. This is captured in issue #46797 Fix this by hooking in to the glibc workaround in `cvt_gai` and only activating it for the "gnu" environment on Unix This should include all glibc platforms while excluding musl, windows-gnu, macOS, FreeBSD, etc. This has the side benefit of removing the #[cfg] in sys_common; only unix.rs has code related to the workaround now. Before this commit: ```shell > cat main.rs use std::net::ToSocketAddrs; #[no_mangle] pub extern "C" fn resolve_test() -> () { let addr_list = ("google.com.au", 0).to_socket_addrs().unwrap(); println!("{:?}", addr_list); } > rustc --crate-type=staticlib main.rs > clang libmain.a test.c -o combined Undefined symbols for architecture x86_64: "_res_9_init", referenced from: std::net::lookup_host::h93c17fe9ad38464a in libmain.a(std-826c8d3b356e180c.std0.rcgu.o) ld: symbol(s) not found for architecture x86_64 clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation) ``` Afterwards: ```shell > rustc --crate-type=staticlib main.rs > clang libmain.a test.c -o combined > ./combined IntoIter([V4(172.217.25.131:0)]) ``` Fixes #46797
2018-01-21NonNull ended up landing in 1.25Simon Sapin-1/+1
2018-01-20Rollup merge of #47578 - arthurprs:btree-doc, r=alexcrichtonGuillaume Gomez-2/+2
Update BTreeMap recommendation Focus on the ordering / range(instead of all) benefit as it's the most important feature.
2018-01-20Rollup merge of #47532 - tbu-:pr_path_oddities, r=TimNNGuillaume Gomez-0/+7
Add some edge cases to the documentation of `Path` Affected methods are `starts_with` and `strip_prefix`.
2018-01-20Rollup merge of #47510 - sfackler:deprecate-dns, r=alexcrichtonGuillaume Gomez-1/+11
Deprecate std::net::lookup_host We intended to do this quite a while ago but it snuck through. r? @alexcrichton
2018-01-20Auto merge of #46980 - ↵bors-2/+2
zackmdavis:and_the_case_of_the_needlessly_parenthesized_arguments, r=petrochenkov in which the unused-parens lint comes to cover function and method args Resolves #46137.
2018-01-20Stabilize std::ptr::NonNullSimon Sapin-2/+1
2018-01-20Mark Unique as perma-unstable, with the feature renamed to ptr_internals.Simon Sapin-2/+2
2018-01-20Rename std::ptr::Shared to NonNullSimon Sapin-7/+7
`Shared` is now a deprecated `type` alias. CC https://github.com/rust-lang/rust/issues/27730#issuecomment-352800629
2018-01-19Update BTreeMap recommendationArthur Silva-2/+2
Focus on the ordering/range benefit.
2018-01-18in which the unused-parens lint comes to cover function and method argsZack M. Davis-2/+2
Resolves #46137.
2018-01-17Deprecate std::net::lookup_hostSteven Fackler-1/+11
We intended to do this quite a while ago but it snuck through.
2018-01-18Add some edge cases to the documentation of `Path`Tobias Bucher-0/+7
Affected methods are `starts_with` and `strip_prefix`.
2018-01-17Rollup merge of #47520 - mbrubeck:fstat, r=Mark-SimulacrumGuillaume Gomez-7/+9
Use File::metadata instead of fs::metadata to choose buffer size This replaces a `stat` syscall with `fstat` or similar, which can be faster. Fixes #47519.
2018-01-17Use File::metadata instead of fs::metadata to choose buffer sizeMatt Brubeck-7/+9
This replaces a `stat` syscall with `fstat` or similar, which can be faster. Fixes #47519.
2018-01-16Only link res_init() on GNU/*nixRyan Cumming-32/+16
To workaround a bug in glibc <= 2.26 lookup_host() calls res_init() based on the glibc version detected at runtime. While this avoids calling res_init() on platforms where it's not required we will still end up linking against the symbol. This causes an issue on macOS where res_init() is implemented in a separate library (libresolv.9.dylib) from the main libc. While this is harmless for standalone programs it becomes a problem if Rust code is statically linked against another program. If the linked program doesn't already specify -lresolv it will cause the link to fail. This is captured in issue #46797 Fix this by hooking in to the glibc workaround in `cvt_gai` and only activating it for the "gnu" environment on Unix This should include all glibc platforms while excluding musl, windows-gnu, macOS, FreeBSD, etc. This has the side benefit of removing the #[cfg] in sys_common; only unix.rs has code related to the workaround now.
2018-01-15Reexport -> re-export in prose and documentation commentsCarol (Nichols || Goulding)-8/+8
2018-01-15Rollup merge of #47443 - FenrirWolf:rand, r=alexcrichtonkennytm-108/+0
Remove leftover Rand stuff The in-tree version of `rand` was removed in 6bc8f164b09b9994e6a2d4c4ca60d7d36c09d3fe, but for some reason this lone file avoided the purge. Figured it's about time to finish the job. :smiling_imp:
2018-01-15Rollup merge of #47330 - bmusin:patch-2, r=shepmasterkennytm-4/+4
fix off-by-one error Fixes https://github.com/rust-lang/rust/issues/47325.
2018-01-15Rollup merge of #47277 - tspiteri:log-correctness, r=frewsxcvkennytm-18/+16
doc: show that `f32::log` and `f64::log` are not correctly rounded Fixes #47273. One thing I'm not sure about is whether the "calculated as `self.ln() / base.ln()`" bit is being too specific, maybe we do not want to make this such a strong commitment. I think it's fine, but we should not make commitments in the API documentation by accident. In case that is removed, the added sentence "`self.log2()` can ... base 10." still makes it amply clear that the `log` methods can be more inaccurate than other methods. If the above clause is removed, this second sentence can be moved to the first paragraph, kind of like the accuracy comment for the [`mul_add`](https://doc.rust-lang.org/std/primitive.f32.html#method.mul_add) method.
2018-01-15Rollup merge of #47120 - clarcharr:io_error_debug, r=dtolnaykennytm-8/+35
Better Debug impl for io::Error. This PR includes the below changes: 1. The former impl wrapped the entire thing in `Error { repr: ... }` which was unhelpful; this has been removed. 2. The `Os` variant of `io::Error` included the code and message, but not the kind; this has been fixed. 3. The `Custom` variant of `io::Error` included a `Custom(Custom { ... })`, which is now just `Custom { ... }`. Example of previous impl: ```rust Error { repr: Custom( Custom { kind: InvalidData, error: Error { repr: Os { code: 2, message: "no such file or directory" } } } ) } ``` Example of new impl: ```rust Custom { kind: InvalidData, error: Os { code: 2, kind: NotFound, message: "no such file or directory" } } ```
2018-01-14Remove leftover Rand stuffFenrir-108/+0
2018-01-14Auto merge of #47268 - EdSchouten:cloudabi-libstd, r=alexcrichtonbors-12/+5055
Implement libstd for CloudABI. Though CloudABI is strongly inspired by POSIX, its absence of features that don't work well with capability-based sandboxing makes it different enough that adding bits to `sys/unix` will make things a mess. This change therefore adds CloudABI specific platform code under `sys/cloudabi`. One of the goals of this implementation is to build as much as possible directly on top of CloudABI's system call layer, as opposed to using the C library. This is preferred, as the system call layer is supposed to be stable, whereas the C library ABI technically is not. An advantage of this approach is that it allows us to implement certain interfaces, such as mutexes and condition variables more optimally. They can be lighter than the ones provided by pthreads. This change disables some modules that cannot realistically be implemented right now. For example, libstd's pathname abstraction is not designed with POSIX `*at()` (e.g., `openat()`) in mind. The `*at()` functions are the only set of file system APIs available on CloudABI. There is no global file system namespace, nor a process working directory. Discussions on how to port these modules over are outside the scope of this change.
2018-01-14Auto merge of #46832 - Diggsey:bufread-cheaper-seek, r=alexcrichtonbors-0/+46
BufRead: Only flush the internal buffer if seeking outside of it. Fixes #31100 r? @dtolnay
2018-01-13Add note to documentationDiggory Blake-0/+4
2018-01-13Implement "seek_relative"Diggory Blake-0/+42
2018-01-13Better Debug impl for io::Error.Clar Charr-8/+35