about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2018-05-13Add “Examples” section header in f32/f64 doc comments.Corey Farwell-0/+152
This is recommend by [RFC 0505] and as far as I know, the only primitive types without this heading. [RFC 0505]: https://github.com/rust-lang/rfcs/blob/c892139be692586e0846fbf934be6fceec17f329/text/0505-api-comment-conventions.md#using-markdown
2018-05-12Do not silently truncate offsets for `read_at`/`write_at` on emscriptenTobias Bucher-2/+16
Generate an IO error if the offset is out of bounds for the system call.
2018-05-12fs::write: Add example writing a &strAaron DeVore-0/+1
2018-05-12Rollup merge of #50602 - Screwtapello:update-canonicalize-docs, r=cramertjMark Simulacrum-4/+11
Update canonicalize docs I was recently working with file-paths in Rust, and I felt let down by the `std::fs::canonicalize` docs, so I figured I should submit a PR with some suggestions. I was looking for a method to turn a relative path into an absolute path. The `canonicalize` docs didn't mention the words "relative" or "absolute", but they did mention resolving symlinks (which is a kind of canonicalisation and does not imply converting to absolute), so I assumed that's all it did. To remedy this, I've added the word "absolute" to the description of both `std::fs::canonicalize` and `std::path::Path::canonicalize`. After calling `canonicalize` on Windows, I ran into a bunch of other problems I would not have expected from the function's behaviour on Linux. Specifically, if you call `canonicalize` on a path: - it's allowed to be much longer than it otherwise would - `.join("a/slash/delimited/path")` gives you a broken path that Windows can't use, where the same operation would have worked perfectly without `canonicalize` (if the path were short enough) - the resulting path may confuse other Windows programs if you pass it to them on the command-line, or write it to a config file that they read, etc. ...so I tried to summarize those behaviours too. If I understand correctly, those behaviours are a side-effect of calling `GetFinalPathNameByHandle`, and the documentation says `canonicalize` might not call that function in future, so maybe those side-effects shouldn't be part of the function's documentation. However, I bet there's a lot of applications deliberately calling `canonicalize` just for the path-length-extension alone, so that particular side-effect is de-facto part of the `canonicalize` interface.
2018-05-12Rollup merge of #50550 - llogiq:fmt-result, r=petrochenkovMark Simulacrum-5/+5
use fmt::Result where applicable This is a quite boring PR, but I think the type alias improves readability, so why not use it?
2018-05-10Auto merge of #50611 - alexcrichton:rollup, r=alexcrichtonbors-21/+23
Rollup of 18 pull requests Successful merges: - #49423 (Extend tests for RFC1598 (GAT)) - #50010 (Give SliceIndex impls a test suite of girth befitting the implementation (and fix a UTF8 boundary check)) - #50447 (Fix update-references for tests within subdirectories.) - #50514 (Pull in a wasm fix from LLVM upstream) - #50524 (Make DepGraph::previous_work_products immutable) - #50532 (Don't use Lock for heavily accessed CrateMetadata::cnum_map.) - #50538 ( Make CrateNum allocation more thread-safe. ) - #50564 (Inline `Span` methods.) - #50565 (Use SmallVec for DepNodeIndex within dep_graph.) - #50569 (Allow for specifying a linker plugin for cross-language LTO) - #50572 (Clarify in the docs that `mul_add` is not always faster.) - #50574 (add fn `into_inner(self) -> (Idx, Idx)` to RangeInclusive (#49022)) - #50575 (std: Avoid `ptr::copy` if unnecessary in `vec::Drain`) - #50588 (Move "See also" disambiguation links for primitive types to top) - #50590 (Fix tuple struct field spans) - #50591 (Restore RawVec::reserve* documentation) - #50598 (Remove unnecessary mutable borrow and resizing in DepGraph::serialize) - #50606 (Retry when downloading the Docker cache.) Failed merges: - #50161 (added missing implementation hint) - #50558 (Remove all reference to DepGraph::work_products)
2018-05-10Auto merge of #50331 - MartinHusemann:master, r=Kimundibors-2/+11
Map the stack guard page with max protection on NetBSD On NetBSD the initial mmap() protection of a mapping can not be made less restrictive with mprotect(). So when mapping a stack guard page, use the maximum protection we ever want to use, then mprotect() it to the permission we want it to have initially. Fixes #50313
2018-05-10Rollup merge of #50588 - ExpHP:i-can-see-my-house-from-here, r=frewsxcvAlex Crichton-17/+15
Move "See also" disambiguation links for primitive types to top Closes #50384. <details> <summary>Images</summary> ![rust-slice](https://user-images.githubusercontent.com/1411280/39843148-caa41c3e-53b7-11e8-8123-b57c25a4d9e0.png) ![rust-isize](https://user-images.githubusercontent.com/1411280/39843146-ca94b384-53b7-11e8-85f3-3f5e5d353a05.png) </details> r? @steveklabnik
2018-05-10Rollup merge of #50572 - frewsxcv:frewsxcv-fma, r=sfacklerAlex Crichton-4/+8
Clarify in the docs that `mul_add` is not always faster. Fixes https://github.com/rust-lang/rust/issues/49842. Other resources: - https://users.rust-lang.org/t/why-does-the-mul-add-method-produce-a-more-accurate-result-with-better-performance/1626 - https://en.wikipedia.org/wiki/Multiply%E2%80%93accumulate_operation
2018-05-10fs::canonicalize has some important portability concerns.Tim Allen-0/+7
2018-05-10Mention that fs::canonicalize makes paths absolute.Tim Allen-4/+4
2018-05-09make std::str link into See also linkMichael Lamparski-5/+3
also make a drive-by typo fix
2018-05-09move See also links to topMichael Lamparski-12/+12
2018-05-09Clarify in the docs that `mul_add` is not always faster.Corey Farwell-4/+8
Fixes https://github.com/rust-lang/rust/issues/49842. Other resources: - https://users.rust-lang.org/t/why-does-the-mul-add-method-produce-a-more-accurate-result-with-better-performance/1626 - https://en.wikipedia.org/wiki/Multiply%E2%80%93accumulate_operation
2018-05-09Rollup merge of #50511 - Manishearth:must-use, r=QuietMisdreavuskennytm-4/+4
Add some explanations for #[must_use] `#[must_use]` can be given a string argument which is shown whilst warning for things. We should add a string argument to most of the user-exposed ones. I added these for everything but the operators, mostly because I'm not sure what to write there or if we need anything there.
2018-05-09Rollup merge of #49988 - clarcharr:never_docs, r=steveklabnikkennytm-0/+53
Mention Result<!, E> in never docs. Fixes #48096.
2018-05-09Fix typoGeorge Burton-1/+1
2018-05-09Update features to 1.28.0George Burton-10/+10
2018-05-09use fmt::Result where applicableAndre Bogus-5/+5
2018-05-07Add explanation for #[must_use] on mutex guardsManish Goregaokar-4/+4
2018-05-06Some final touches to ensure `./x.py test --stage 0 src/lib*` workskennytm-2/+2
2018-05-05Fixed typosClar Charr-6/+7
2018-05-03Remove the deprecated std::net::{lookup_host,LookupHost}Josh Stone-68/+1
These are unstable, and were deprecated by #47510, since Rust 1.25. The internal `sys` implementations are still kept to support the call in the common `resolve_socket_addr`.
2018-05-04Rollup merge of #50406 - ExpHP:concat-nonzero-idents, r=dtolnaykennytm-2/+2
Forbid constructing empty identifiers from concat_idents The empty identifier is a [reserved identifier](https://github.com/rust-lang/rust/blob/8a37c75a3a661385cc607d934c70e86a9eaf5fd7/src/libsyntax_pos/symbol.rs#L300-L305) in rust, apparently used for black magicks like representing the crate root or somesuch... and therefore, being able to construct it is Ungood. Presumably. ...even if the macro that lets you construct it is so useless that you can't actually do any damage with it. (and believe me, I tried) Fixes #50403. **Note:** I noticed that when you try to do something similar with `proc_macro::Term`, the compiler actually catches it and flags the identifier as reserved. Perhaps a better solution would be to somehow have that same check applied here.
2018-05-03update concat_idents doc stubsMichael Lamparski-2/+2
2018-05-02Revert "Implement FromStr for PathBuf"Alex Crichton-27/+0
This reverts commit 05a9acc3b844ff284a3e3d85dde2d9798abfb215.
2018-05-02Add comments and unify guard page setup.Martin Husemann-16/+13
While currently only NetBSD seems to be affected, all systems implementing PAX MPROTECT in strict mode need this treatment, and it does not hurt others.
2018-05-01Fix an error from "unused" lint + Fix rebaseVadim Petrochenkov-0/+1
2018-05-01Remove `macro_reexport`Vadim Petrochenkov-8/+8
It's subsumed by `feature(use_extern_macros)` and `pub use`
2018-04-30Auto merge of #48925 - zackmdavis:fn_must_stabilize, r=nikomatsakisbors-0/+4
stabilize `#[must_use]` for functions and must-use comparison operators (RFC 1940) r? @nikomatsakis
2018-04-30Auto merge of #50345 - kennytm:rollup, r=kennytmbors-20/+42
Rollup of 7 pull requests Successful merges: - #50233 (Make `Vec::new` a `const fn`) - #50312 (Add more links in panic docs) - #50316 (Fix some broken links in docs.) - #50325 (Add a few more tests for proc macro feature gating) - #50327 (Display correct unused field suggestion for nested struct patterns) - #50330 (check that #[used] is used only on statics) - #50344 (Update Cargo to 2018-04-28 122fd5be5201913d42e219e132d6569493583bca) Failed merges:
2018-05-01Rollup merge of #50316 - ehuss:fix-doc-links, r=frewsxcvkennytm-1/+2
Fix some broken links in docs.
2018-05-01Rollup merge of #50312 - Pazzaz:master, r=GuillaumeGomezkennytm-19/+40
Add more links in panic docs Fixes #48695 by adding a link to `AssertUnwindSafe`. Also added some other links in the module's docs to make things clearer.
2018-04-30Auto merge of #50163 - kornelski:error, r=Kimundibors-39/+26
Bury Error::description() Second attempt of #49536 https://github.com/rust-lang/rfcs/pull/2230 The exact wording of the default implementation is still up in the air, but I think it's a detail that can be amended later.
2018-04-30Map the stack guard page with max protection on NetBSDMartin Husemann-4/+16
On NetBSD the initial mmap() protection of a mapping can not be made less restrictive with mprotect(). So when mapping a stack guard page, use the maximum protection we ever want to use, then mprotect() it to the permission we want it to have initially.
2018-04-29Fix some broken links in docs.Eric Huss-1/+2
2018-04-29Add more links in panic docsPazzaz-19/+40
2018-04-28stabilize `#[must_use]` for functions and must-use operatorsZack M. Davis-0/+4
This is in the matter of RFC 1940 and tracking issue #43302.
2018-04-28std: Inline `DefaultResizePolicy::new`Alex Crichton-0/+1
This should allow us to tighten up the [codegen][example] a bit more, avoiding a function call across object boundaries in the default optimized case. [example]: https://play.rust-lang.org/?gist=c1179088b0f8a4dcd93a9906463f993d&version=stable&mode=release
2018-04-27Update the stable attributes to use the current nightly version numberGeorge Burton-10/+10
2018-04-27Add pathbuf_from_cow_pathGeorge Burton-0/+8
2018-04-27Add cstring_from_cow_cstr and osstring_from_cow_osstrGeorge Burton-0/+16
2018-04-25Suggest alternatives to Error::description()Kornel-1/+3
2018-04-25Move description of the Error trait to its own doc-commentSimon Sapin-39/+24
… rather than the module’s. Remove code definition of the Error trait from its doc-comment It was out of date, and rustdoc already shows the same information. Add a default impl for Error::description and document it as deprecated. It is redundant with Display while being much less flexible for implementors. This is only a "soft" deprecation: it is not worth the hassle of a warning to existing users. Tweak Error trait docs to reflect actual requirements
2018-04-24Auto merge of #50079 - NickAtAccuPS:android_abstract_socket, r=sfacklerbors-1/+4
Android abstract unix domain sockets AddressKind correction The prior check causes abstract unix domain sockets to return AddressKind::Unnamed instead of AddressKind::Abstract on Android. Other than the immediately proceeding comment "macOS seems to return a len of 16 and a zeroed sun_path for unnamed addresses" the check as-implemented does not seem to have alternative explanation. I couldn't find an alternative explanation while stepping though git blame. I suspect the AddressKind::Unnamed nonzero check should instead be if macos, length 16, and zeroed array. @sfackler could you comment on this, the code as-is is the same from your initial addition of abstract uds support.
2018-04-24Rollup merge of #49970 - SimonSapin:deprecate, r=sfacklerkennytm-1/+17
Deprecate Read::chars and char::decode_utf8 Per FCP: * https://github.com/rust-lang/rust/issues/27802#issuecomment-377537778 * https://github.com/rust-lang/rust/issues/33906#issuecomment-377534308
2018-04-24Rollup merge of #49906 - kennytm:stable-unreachable, r=sfacklerkennytm-0/+2
Stabilize `std::hint::unreachable_unchecked`. Closes #43751.
2018-04-24Rollup merge of #49829 - ecstatic-morse:os-docs, r=steveklabnikkennytm-60/+135
Add doc links to `std::os` extension traits Addresses a small subset of #29367. This adds documentation links to the original type for various OS-specific extension traits, and uses a common sentence for introducing such traits (which now consistently ends in a period).
2018-04-24Rollup merge of #49461 - andreastt:child-kill-exited, r=Mark-Simulacrumkennytm-2/+11
std: Child::kill() returns error if process has already exited This patch makes it clear in std::process::Child::kill()'s API documentation that an error is returned if the child process has already cleanly exited. This is implied by the example, but not called out explicitly.
2018-04-24Auto merge of #48989 - ExpHP:path-prefix, r=dtolnaybors-9/+11
Make signature of Path::strip_prefix accept non-references I did this a while back but didn't submit a PR. Might as well see what happens. Fixes #48390. **Note: This has the potential to cause regressions in type inference.** However, in order for code to break, it would need to be relying on the signature to determine that a type is `&_`, while still being able to figure out what the `_` is. I'm having a hard time imagining such a scenario in real code.