about summary refs log tree commit diff
path: root/library/std/src
AgeCommit message (Collapse)AuthorLines
2020-08-19Rollup merge of #75646 - poliorcetics:intra-links-keywords, r=jyn514Yuki Okushi-16/+4
Move to intra doc links for keyword documentation Helps with #75080. @rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc
2020-08-18Make `grow_impl` unsafeTim Diekmann-3/+6
2020-08-18Add comment, which was removed by accident (again)Tim Diekmann-0/+2
2020-08-18Clean up AllocRef implementation and documentationTim Diekmann-77/+77
2020-08-18Auto merge of #75621 - TimDiekmann:no-fast-realloc, r=Amanieubors-17/+10
Remove fast path in reallocation for same layout sizes r? @Amanieu Before merging a perf-run should be done. Closes https://github.com/rust-lang/wg-allocators/issues/70
2020-08-18Rollup merge of #75629 - EllenNyan:ellen-intra-doc-links, r=jyn514Yuki Okushi-65/+13
Use intra-doc links in `std::env`, `std::alloc` and `std::error` This is partial fixes for #75080.
2020-08-18Rollup merge of #75464 - poliorcetics:intra-links-panic-and-ascii, r=jyn514Yuki Okushi-30/+10
Move to intra doc links for ascii.rs and panic.rs Helps with #75080. @rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc I also updated the doc to fix the wording in `AsciiExt` since it is now deprecated. The two file are small changes so I bundled them together. Some links could not be changed to make them work, I believe those are known issues with primitive types.
2020-08-17Move to intra doc links for keyword documentationAlexis Bourget-16/+4
2020-08-17Remove unnecessary links in env.rsEllen-8/+0
2020-08-17Switch to intra-doc links for std/src/alloc.rsEllen-9/+0
2020-08-17Switch to intra-doc links for std/src/env.rsEllen-27/+14
2020-08-17Switch to intra-doc links for std/src/error.rsEllen-25/+3
2020-08-17Fix typo in commentTim Diekmann-2/+2
2020-08-17Remove fast path in reallocation for same layout sizesTim Diekmann-17/+10
2020-08-17Auto merge of #75468 - poliorcetics:intra-links-fs, r=jyn514bors-132/+59
Move to intra doc links in std/src/fs.rs Helps with #75080. @rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc
2020-08-16Switch to intra-doc links in /sys/windows/ext/{ffi,fs,process}.rsPrabakaran Kumaresshan-34/+8
2020-08-16Auto merge of #75567 - poliorcetics:intra-links-std-net, r=jyn514bors-293/+142
Move to intra doc links in std::net Helps with #75080. @rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc The links for `true` and `false` had to stay else `rustdoc` complained, it is intended ?
2020-08-16Fix a link, improve method resolutionAlexis Bourget-24/+27
2020-08-16Auto merge of #75565 - nixphix:docs/vxworks-ext, r=jyn514bors-30/+11
Switch to intra-doc links in std/src/sys/vxworks/ext/{fs,process}.rs Partial fix for #75080 @rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc r? @jyn514
2020-08-15Auto merge of #75246 - pickfire:patch-5, r=Amanieubors-2/+7
Add more examples to Path ends_with We faced a footgun when using ends_with to check extension, showing an example could prevent that. https://github.com/rust-dc/fish-manpage-completions/pull/106/commits/2c155e50b2d9e607174908b3f80f1dcf92693eee
2020-08-15Move to intra doc links in std::netAlexis Bourget-293/+139
2020-08-15inline linkingPrabakaran Kumaresshan-6/+2
2020-08-15remove empty linesPrabakaran Kumaresshan-7/+0
2020-08-15resolve commentsPrabakaran Kumaresshan-16/+8
2020-08-15Switch to intra-doc links in std/src/sys/vxworks/ext/{fs,process}.rsPrabakaran Kumaresshan-19/+19
2020-08-15Auto merge of #74576 - myfreeweb:freebsd-sanitizers, r=oli-obkbors-1/+13
Add sanitizer support on FreeBSD Restarting #47337. Everything is better now, no more weird llvm problems, well not everything: Unfortunately, the sanitizers don't have proper support for versioned symbols (https://github.com/google/sanitizers/issues/628), so `libc`'s usage of `stat@FBSD_1.0` and so on explodes, e.g. in calling `std::fs::metadata`. Building std (now easy thanks to cargo `-Zbuild-std`) and libc with `freebsd12/13` config via the `LIBC_CI=1` env variable is a good workaround… ``` LIBC_CI=1 RUSTFLAGS="-Z sanitizer=address" cargo +san-test -Zbuild-std run --target x86_64-unknown-freebsd --verbose ``` …*except* std won't build because there's no `st_lspare` in the ino64 version of the struct, so an std patch is required: ```diff --- i/src/libstd/os/freebsd/fs.rs +++ w/src/libstd/os/freebsd/fs.rs @@ -66,8 +66,6 @@ pub trait MetadataExt { fn st_flags(&self) -> u32; #[stable(feature = "metadata_ext2", since = "1.8.0")] fn st_gen(&self) -> u32; - #[stable(feature = "metadata_ext2", since = "1.8.0")] - fn st_lspare(&self) -> u32; } #[stable(feature = "metadata_ext", since = "1.1.0")] @@ -136,7 +134,4 @@ impl MetadataExt for Metadata { fn st_flags(&self) -> u32 { self.as_inner().as_inner().st_flags as u32 } - fn st_lspare(&self) -> u32 { - self.as_inner().as_inner().st_lspare as u32 - } } ``` I guess std could like.. detect that `libc` isn't built for the old ABI, and replace the implementation of `st_lspare` with a panic?
2020-08-15Use resolve.conf as example for Path ends_withIvan Tham-6/+6
2020-08-14Rollup merge of #75545 - eddyb:instant-sub-branchless, r=sfacklerTyler Mandry-8/+20
std/sys/unix/time: make it easier for LLVM to optimize `Instant` subtraction. This PR is the minimal change necessary to get LLVM to optimize `if self.t.tv_nsec >= other.t.tv_nsec` to branchless instructions (at least on x86_64), inspired by @m-ou-se's own attempts at optimizing `Instant` subtraction. I stumbled over this by looking at the total number of instructions executed by `rustc -Z self-profile`, and found that after disabling ASLR, the largest source of non-determinism remaining was from this `if` taking one branch or the other, depending on the values involved. The reason this code is even called so many times to make a difference, is that `measureme` (the `-Z self-profile` implementation) currently uses `Instant::elapsed` for its event timestamps (of which there can be millions). I doubt it's critical to land this, although perhaps it could slightly improve some forms of benchmarking.
2020-08-15std/sys/unix/time: make it easier for LLVM to optimize `Instant` subtraction.Eduard-Mihai Burtescu-8/+20
2020-08-14Rollup merge of #75530 - nixphix:docs/os-raw, r=jyn514Tyler Mandry-33/+13
Switch to intra-doc links in os/raw/*.md Partial fix for #75080 @rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc r? @jyn514
2020-08-14Rollup merge of #75501 - poliorcetics:intra-links-std-ffi, r=jyn514Tyler Mandry-233/+81
Move to intra doc links in std::ffi Helps with #75080. @rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc
2020-08-14Rollup merge of #75432 - camelid:intra-doc-links-for-std-process, r=jyn514Tyler Mandry-58/+37
Switch to intra-doc links in `std::process` Part of #75080.
2020-08-14Rollup merge of #74409 - ↵Tyler Mandry-2/+16
LukasKalbertodt:improve-debug-impl-of-socketaddr-ipaddr, r=Amanieu Change Debug impl of SocketAddr and IpAddr to match their Display output This has already been done for `SocketAddrV4`, `SocketAddrV6`, `IpAddrV4` and `IpAddrV6`. I don't see a point to keep the rather bad to read derived impl, especially so when pretty printing: V4( 127.0.0.1 ) From the `Display`, one can easily and unambiguously see if it's V4 or V6. Two examples: ``` 127.0.0.1:443 [2001:db8:85a3::8a2e:370:7334]:443 ``` Luckily the docs explicitly state that `Debug` output is not stable and that it may be changed at any time. Using `Display` as `Debug` is very convenient for configuration structs (e.g. for webservers) that often just have a `derive(Debug)` and are printed that way to the one starting the server.
2020-08-14Rollup merge of #74192 - xkr47:patch-1, r=Mark-SimulacrumTyler Mandry-3/+24
Improve documentation on process::Child.std* fields As a relative beginner, it took a while for me to figure out I could just steal the references to avoid partially moving the child and thus retain ability to call functions on it (and store it in structs etc).
2020-08-14Rollup merge of #74062 - poliorcetics:unsafe-in-unsafe-c_str, r=Mark-SimulacrumTyler Mandry-7/+32
deny(unsafe_op_in_unsafe_fn) in libstd/ffi/c_str.rs Partial fix of #73904. This encloses `unsafe` operations in `unsafe fn` in `libstd/ffi/c_str.rs`.
2020-08-14Document the unsafe keywordAlexis Bourget-3/+181
2020-08-14libstd/ffi/c_str.rs: #![deny(unsafe_op_in_unsafe_fn)], enclose unsafe ↵Alexis Bourget-7/+32
operations in unsafe blocks
2020-08-14Apply suggestions from code reviewPoliorcetics-3/+3
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-08-14remove primitive type linksPrabakaran Kumaresshan-20/+0
2020-08-14Switch to intra-doc links in os/raw/*.mdPrabakaran Kumaresshan-33/+33
2020-08-14Improve documentation on process::Child.std* fieldsJonas Berlin-3/+24
As a relative beginner, it took a while for me to figure out I could just steal the references to avoid partially moving the child and thus retain ability to call functions on it (and store it in structs etc).
2020-08-13Rollup merge of #75477 - RalfJung:fn-ptrs, r=Mark-SimulacrumTyler Mandry-9/+48
Expand function pointer docs Be more explicit in the ABI section, and add a section on how to obtain a function pointer, which can be somewhat confusing. Cc https://github.com/rust-lang/rust/issues/75239
2020-08-13Move to intra doc links in std::ffiAlexis Bourget-233/+81
2020-08-13fn type: structure, and talk a bit more about ABIs and how to create themRalf Jung-9/+48
2020-08-13Rollup merge of #75469 - camelid:intra-doc-links-std-io-mod, r=KodrAusYuki Okushi-21/+6
Switch to intra-doc links in `std/io/mod.rs` Part of #75080.
2020-08-13Rollup merge of #75466 - poliorcetics:intra-links-std-lib, r=KodrAusYuki Okushi-40/+27
Move to intra doc links whenever possible within std/src/lib.rs Helps with #75080. @rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc There are some things like ```rust `//! [`Option<T>`]: option::Option` ``` that will either be fixed in the future or have open issues about them.
2020-08-13Rollup merge of #75455 - pickfire:patch-3, r=jyn514Yuki Okushi-6/+2
Use explicit path link in place for doc in time r? @jyn514 More worth for your time. :P
2020-08-13Rollup merge of #75400 - LukasKalbertodt:fix-f32-docs, r=KodrAusYuki Okushi-5/+3
Fix minor things in the `f32` primitive docs All of these were review comments in #74621 that I first fixed in that PR, but later accidentally overwrote by a force push. Thanks @the8472 for noticing. r? @KodrAus
2020-08-13Rollup merge of #75189 - kawamuray:bugfix-wasi-append, r=KodrAusYuki Okushi-3/+5
Fix wasi::fs::OpenOptions to imply write when append is on This PR fixes a bug in `OpenOptions` of `wasi` platform that it currently doesn't imply write mode when only `append` is enabled. As explained in the [doc of OpenOptions#append](https://doc.rust-lang.org/std/fs/struct.OpenOptions.html#method.append), calling `.append(true)` should imply `.write(true)` as well. ## Reproduce Given below simple Rust program: ```rust use std::fs::OpenOptions; use std::io::Write; fn main() { let mut file = OpenOptions::new() .write(true) .create(true) .open("foo.txt") .unwrap(); writeln!(file, "abc").unwrap(); } ``` it can successfully compiled into wasm and execute by `wasmtime` runtime: ```sh $ rustc --target wasm32-wasi write.rs $ ~/wasmtime/target/debug/wasmtime run --dir=. write.wasm $ cat foo.txt abc ``` However when I change `.write(true)` to `.append(true)`, it fails to execute by the error "Capabilities insufficient": ```sh $ ~/wasmtime/target/debug/wasmtime run --dir=. append.wasm thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 76, kind: Other, message: "Capabilities insufficient" }', append.rs:10:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace Error: failed to run main module `append.wasm` ... ``` This is because of lacking "rights" on the opened file: ```sh $ RUST_LOG=trace ~/wasmtime/target/debug/wasmtime run --dir=. append.wasm 2>&1 | grep validate_rights TRACE wasi_common::entry > | validate_rights failed: required rights = HandleRights { base: fd_write (0x40), inheriting: empty (0x0) }; actual rights = HandleRights { base: fd_seek|fd_fdstat_set_flags|fd_sync|fd_tell|fd_advise|fd_filestat_set_times|poll_fd_readwrite (0x88000bc), inheriting: empty (0x0) } ```
2020-08-12Fix intra-doc linkCamelid-0/+1